diff --git a/packages/ast-spec/src/base/ClassBase.ts b/packages/ast-spec/src/base/ClassBase.ts index 43e4da99d0a..595d1393ac4 100644 --- a/packages/ast-spec/src/base/ClassBase.ts +++ b/packages/ast-spec/src/base/ClassBase.ts @@ -13,10 +13,8 @@ export interface ClassBase extends BaseNode { * ``` * abstract class Foo {...} * ``` - * This is always `undefined` for `ClassExpression`. */ - // TODO(#5020) - make this `false` if it is not `abstract` - abstract?: boolean; + abstract: boolean; /** * The class body. */ @@ -26,21 +24,16 @@ export interface ClassBase extends BaseNode { * ``` * declare class Foo {...} * ``` - * This is always `undefined` for `ClassExpression`. */ - // TODO(#5020) - make this `false` if it is not `declare`d - declare?: boolean; + declare: boolean; /** * The decorators declared for the class. - * This is `undefined` if there are no decorators. * ``` * @deco * class Foo {...} * ``` - * This is always `undefined` for `ClassExpression`. */ - // TODO(#5020) - make this an empty array if there are none declared - decorators?: Decorator[]; + decorators: Decorator[]; /** * The class's name. * - For a `ClassExpression` this may be `null` if the name is omitted. @@ -50,25 +43,22 @@ export interface ClassBase extends BaseNode { id: Identifier | null; /** * The implemented interfaces for the class. - * This is `undefined` if there are no implemented interfaces. */ - implements?: TSClassImplements[]; + implements: TSClassImplements[]; /** * The super class this class extends. */ superClass: LeftHandSideExpression | null; /** * The generic type parameters passed to the superClass. - * This is `undefined` if there are no generic type parameters passed. */ - superTypeArguments?: TSTypeParameterInstantiation; + superTypeArguments: TSTypeParameterInstantiation | undefined; /** @deprecated Use {@link `superTypeArguments`} instead. */ - superTypeParameters?: TSTypeParameterInstantiation; + superTypeParameters: TSTypeParameterInstantiation | undefined; /** * The generic type parameters declared for the class. - * This is `undefined` if there are no generic type parameters declared. */ - typeParameters?: TSTypeParameterDeclaration; + typeParameters: TSTypeParameterDeclaration | undefined; } diff --git a/packages/ast-spec/src/base/FunctionBase.ts b/packages/ast-spec/src/base/FunctionBase.ts index 56446bc78ba..035b18a682e 100644 --- a/packages/ast-spec/src/base/FunctionBase.ts +++ b/packages/ast-spec/src/base/FunctionBase.ts @@ -23,15 +23,14 @@ export interface FunctionBase extends BaseNode { * - For a `TSDeclareFunction` this is always `undefined`. * - For a `TSEmptyBodyFunctionExpression` this is always `null`. */ - body?: BlockStatement | Expression | null; + body: BlockStatement | Expression | null | undefined; /** * This is only `true` if and only if the node is a `TSDeclareFunction` and it has `declare`: * ``` * declare function foo(...) {...} * ``` */ - // TODO(#5020) - make this always `false` if it is not `declare`d instead of `undefined` - declare?: boolean; + declare: boolean; /** * This is only ever `true` if and only the node is an `ArrowFunctionExpression` and the body * is an expression: @@ -63,12 +62,10 @@ export interface FunctionBase extends BaseNode { params: Parameter[]; /** * The return type annotation for the function. - * This is `undefined` if there is no return type declared. */ - returnType?: TSTypeAnnotation; + returnType: TSTypeAnnotation | undefined; /** * The generic type parameter declaration for the function. - * This is `undefined` if there are no generic type parameters declared. */ - typeParameters?: TSTypeParameterDeclaration; + typeParameters: TSTypeParameterDeclaration | undefined; } diff --git a/packages/ast-spec/src/base/MethodDefinitionBase.ts b/packages/ast-spec/src/base/MethodDefinitionBase.ts index 8aaa1c297e5..f2815458d58 100644 --- a/packages/ast-spec/src/base/MethodDefinitionBase.ts +++ b/packages/ast-spec/src/base/MethodDefinitionBase.ts @@ -17,10 +17,10 @@ interface MethodDefinitionBase extends BaseNode { computed: boolean; static: boolean; kind: 'constructor' | 'get' | 'method' | 'set'; - optional?: boolean; - decorators?: Decorator[]; - accessibility?: Accessibility; - override?: boolean; + optional: boolean; + decorators: Decorator[]; + accessibility: Accessibility | undefined; + override: boolean; } export interface MethodDefinitionComputedNameBase extends MethodDefinitionBase { diff --git a/packages/ast-spec/src/base/PropertyDefinitionBase.ts b/packages/ast-spec/src/base/PropertyDefinitionBase.ts index f1d5b9cc440..a379ac92242 100644 --- a/packages/ast-spec/src/base/PropertyDefinitionBase.ts +++ b/packages/ast-spec/src/base/PropertyDefinitionBase.ts @@ -16,13 +16,13 @@ interface PropertyDefinitionBase extends BaseNode { computed: boolean; static: boolean; declare: boolean; - readonly?: boolean; - decorators?: Decorator[]; - accessibility?: Accessibility; - optional?: boolean; - definite?: boolean; - typeAnnotation?: TSTypeAnnotation; - override?: boolean; + readonly: boolean; + decorators: Decorator[]; + accessibility: Accessibility | undefined; + optional: boolean; + definite: boolean; + typeAnnotation: TSTypeAnnotation | undefined; + override: boolean; } export interface PropertyDefinitionComputedNameBase diff --git a/packages/ast-spec/src/base/TSFunctionSignatureBase.ts b/packages/ast-spec/src/base/TSFunctionSignatureBase.ts index 0da1e7b414d..afd906f3778 100644 --- a/packages/ast-spec/src/base/TSFunctionSignatureBase.ts +++ b/packages/ast-spec/src/base/TSFunctionSignatureBase.ts @@ -5,6 +5,6 @@ import type { BaseNode } from './BaseNode'; export interface TSFunctionSignatureBase extends BaseNode { params: Parameter[]; - returnType?: TSTypeAnnotation; - typeParameters?: TSTypeParameterDeclaration; + returnType: TSTypeAnnotation | undefined; + typeParameters: TSTypeParameterDeclaration | undefined; } diff --git a/packages/ast-spec/src/base/TSHeritageBase.ts b/packages/ast-spec/src/base/TSHeritageBase.ts index b102123ca60..dc7f701f0f1 100644 --- a/packages/ast-spec/src/base/TSHeritageBase.ts +++ b/packages/ast-spec/src/base/TSHeritageBase.ts @@ -5,8 +5,8 @@ import type { BaseNode } from './BaseNode'; export interface TSHeritageBase extends BaseNode { // TODO(#1852) - this should be restricted to MemberExpression | Identifier expression: Expression; - typeArguments?: TSTypeParameterInstantiation; + typeArguments: TSTypeParameterInstantiation | undefined; /** @deprecated Use {@link `typeArguments`} instead. */ - typeParameters?: TSTypeParameterInstantiation; + typeParameters: TSTypeParameterInstantiation | undefined; } diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/1-TSESTree-AST.shot index bae3f5a8287..64e97c1b760 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/1-TSESTree-AST.shot @@ -17,9 +17,13 @@ Program { end: { column: 21, line: 1 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [15, 18], loc: { @@ -27,6 +31,7 @@ Program { end: { column: 18, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 21], diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/5-AST-Alignment-AST.shot index 54a7219ce9a..b4665912df8 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures declaration ClassDeclaration abstract AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + abstract: true, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [19, 21], + loc: { + start: { column: 19, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, +- 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, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot index d20ffd3e130..c3e3ad5c040 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -17,9 +18,12 @@ Program { }, }, declare: true, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [14, 17], loc: { @@ -27,6 +31,7 @@ Program { end: { column: 17, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 20], diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot index 9fbaa86d5a2..7b52ed82f8c 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures declaration ClassDeclaration declare AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [18, 20], + loc: { + start: { column: 18, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + declare: true, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/1-TSESTree-AST.shot index 7f37d13c488..a0dac6da40d 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,12 +17,15 @@ Program { end: { column: 12, line: 3 }, }, }, + declare: false, decorators: Array [ Decorator { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: Array [], name: "decoratorOne", + optional: false, range: [1, 13], loc: { @@ -40,7 +44,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: Array [], name: "decoratorTwo", + optional: false, range: [15, 27], loc: { @@ -58,7 +64,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [34, 37], loc: { @@ -66,6 +74,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, range: [0, 40], diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/5-AST-Alignment-AST.shot index 751a6cc951f..8170c78f09b 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,98 @@ exports[`AST Fixtures declaration ClassDeclaration decorator-many AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [38, 40], + loc: { + start: { column: 10, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, +- declare: false, + decorators: Array [ + Decorator { + type: 'Decorator', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'decoratorOne', +- optional: false, + + range: [1, 13], + loc: { + start: { column: 1, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Decorator { + type: 'Decorator', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'decoratorTwo', +- optional: false, + + range: [15, 27], + loc: { + start: { column: 1, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, + + range: [14, 27], + loc: { + start: { column: 0, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, + ], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [34, 37], + loc: { + start: { column: 6, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [0, 40], + loc: { + start: { column: 0, line: 1 }, + end: { column: 12, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 41], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/1-TSESTree-AST.shot index aba5fc9308d..563d92bd12f 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,12 +17,15 @@ Program { end: { column: 12, line: 2 }, }, }, + declare: false, decorators: Array [ Decorator { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: Array [], name: "decorator", + optional: false, range: [1, 10], loc: { @@ -39,7 +43,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [17, 20], loc: { @@ -47,6 +53,7 @@ Program { end: { column: 9, line: 2 }, }, }, + implements: Array [], superClass: null, range: [0, 23], diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/5-AST-Alignment-AST.shot index 503bd4f5ad8..373c6c0b694 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,77 @@ exports[`AST Fixtures declaration ClassDeclaration decorator-one AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [21, 23], + loc: { + start: { column: 10, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, +- declare: false, + decorators: Array [ + Decorator { + type: 'Decorator', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'decorator', +- optional: false, + + range: [1, 10], + loc: { + start: { column: 1, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [0, 10], + loc: { + start: { column: 0, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + ], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [17, 20], + loc: { + start: { column: 6, line: 2 }, + end: { column: 9, line: 2 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 12, line: 2 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 3 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot index 9ead7d30ab7..31df417d6ce 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,9 +17,13 @@ Program { end: { column: 12, line: 1 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -26,6 +31,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 12], diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot index 795e34e032c..230ef4b49bc 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures declaration ClassDeclaration empty AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [10, 12], + loc: { + start: { column: 10, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/1-TSESTree-AST.shot index dc5437192e6..2a09699f774 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,9 +17,13 @@ Program { end: { column: 28, line: 1 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -26,6 +31,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: Literal { type: "Literal", raw: "'Thing'", diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/5-AST-Alignment-AST.shot index 432a1483eb4..f4826edf0bd 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,65 @@ exports[`AST Fixtures declaration ClassDeclaration extends-literal AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [26, 28], + loc: { + start: { column: 26, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, +- implements: Array [], + superClass: Literal { + type: 'Literal', + raw: '\\\\'Thing\\\\'', + value: 'Thing', + + range: [18, 25], + loc: { + start: { column: 18, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/1-TSESTree-AST.shot index 313a1a2ca5c..192aa4aab46 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,9 +17,13 @@ Program { end: { column: 32, line: 1 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -26,9 +31,12 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: Identifier { type: "Identifier", + decorators: Array [], name: "Set", + optional: false, range: [18, 21], loc: { diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/5-AST-Alignment-AST.shot index 91f3d48279a..048d8b479ca 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures declaration ClassDeclaration extends-type-param AST Alignm body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures declaration ClassDeclaration extends-type-param AST Alignm end: { column: 32, line: 1 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -30,16 +35,19 @@ exports[`AST Fixtures declaration ClassDeclaration extends-type-param AST Alignm end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Set', +- optional: false, range: [18, 21], loc: { start: { column: 18, line: 1 }, end: { column: 21, line: 1 }, - }, - }, +- }, +- }, - superTypeArguments: TSTypeParameterInstantiation { - type: 'TSTypeParameterInstantiation', - params: Array [ @@ -58,8 +66,8 @@ exports[`AST Fixtures declaration ClassDeclaration extends-type-param AST Alignm - loc: { - start: { column: 21, line: 1 }, - end: { column: 29, line: 1 }, -- }, -- }, + }, + }, superTypeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/1-TSESTree-AST.shot index d8241f2f4d5..1cb7686b2fb 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,9 +17,13 @@ Program { end: { column: 27, line: 1 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -26,9 +31,12 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: Identifier { type: "Identifier", + decorators: Array [], name: "Object", + optional: false, range: [18, 24], loc: { diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/5-AST-Alignment-AST.shot index 7408520a611..724e995d358 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,66 @@ exports[`AST Fixtures declaration ClassDeclaration extends AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [25, 27], + loc: { + start: { column: 25, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, +- implements: Array [], + superClass: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Object', +- optional: false, + + range: [18, 24], + loc: { + start: { column: 18, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/1-TSESTree-AST.shot index 6467e4a37f0..98f7f00d3fa 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,9 +17,13 @@ Program { end: { column: 48, line: 1 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -31,7 +36,9 @@ Program { type: "TSClassImplements", expression: Identifier { type: "Identifier", + decorators: Array [], name: "Object", + optional: false, range: [21, 27], loc: { @@ -50,7 +57,9 @@ Program { type: "TSClassImplements", expression: Identifier { type: "Identifier", + decorators: Array [], name: "Function", + optional: false, range: [29, 37], loc: { @@ -69,7 +78,9 @@ Program { type: "TSClassImplements", expression: Identifier { type: "Identifier", + decorators: Array [], name: "RegExp", + optional: false, range: [39, 45], loc: { diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/5-AST-Alignment-AST.shot index 77b0476655c..d38bcdd0e91 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures declaration ClassDeclaration implements-many AST Alignment body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures declaration ClassDeclaration implements-many AST Alignment end: { column: 48, line: 1 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -37,7 +42,9 @@ exports[`AST Fixtures declaration ClassDeclaration implements-many AST Alignment + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Object', +- optional: false, range: [21, 27], loc: { @@ -58,7 +65,9 @@ exports[`AST Fixtures declaration ClassDeclaration implements-many AST Alignment + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Function', +- optional: false, range: [29, 37], loc: { @@ -79,7 +88,9 @@ exports[`AST Fixtures declaration ClassDeclaration implements-many AST Alignment + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'RegExp', +- optional: false, range: [39, 45], loc: { diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/1-TSESTree-AST.shot index c5228690b09..81c06012334 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,9 +17,13 @@ Program { end: { column: 30, line: 1 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -31,7 +36,9 @@ Program { type: "TSClassImplements", expression: Identifier { type: "Identifier", + decorators: Array [], name: "Object", + optional: false, range: [21, 27], loc: { diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/5-AST-Alignment-AST.shot index b0aec089f61..e8a1bd9feae 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures declaration ClassDeclaration implements-one AST Alignment body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures declaration ClassDeclaration implements-one AST Alignment end: { column: 30, line: 1 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -37,7 +42,9 @@ exports[`AST Fixtures declaration ClassDeclaration implements-one AST Alignment + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Object', +- optional: false, range: [21, 27], loc: { diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/1-TSESTree-AST.shot index 13f2fe48ba0..e200139e258 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,9 +17,13 @@ Program { end: { column: 15, line: 1 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -26,6 +31,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -35,7 +41,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [10, 11], loc: { diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/5-AST-Alignment-AST.shot index 0ee9dbba035..9b530ba8f6f 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures declaration ClassDeclaration type-param AST Alignment - AS body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures declaration ClassDeclaration type-param AST Alignment - AS end: { column: 15, line: 1 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -30,6 +35,7 @@ exports[`AST Fixtures declaration ClassDeclaration type-param AST Alignment - AS end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -39,7 +45,9 @@ exports[`AST Fixtures declaration ClassDeclaration type-param AST Alignment - AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [10, 11], - loc: { diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/1-TSESTree-AST.shot index ef17890bb62..1b34f609f86 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,9 +17,13 @@ Program { end: { column: 30, line: 1 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -26,9 +31,12 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: Identifier { type: "Identifier", + decorators: Array [], name: "Set", + optional: false, range: [21, 24], loc: { @@ -43,7 +51,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [25, 26], loc: { @@ -73,7 +83,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [25, 26], loc: { @@ -104,7 +116,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [10, 11], loc: { diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/5-AST-Alignment-AST.shot index 5c6479136e9..823f0eeca30 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type- body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type- end: { column: 30, line: 1 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -30,9 +35,12 @@ exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type- end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Set', +- optional: false, range: [21, 24], loc: { @@ -47,7 +55,9 @@ exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type- - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [25, 26], - loc: { @@ -77,7 +87,9 @@ exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type- type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [25, 26], loc: { @@ -108,7 +120,9 @@ exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type- - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [10, 11], - loc: { diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot index bdbfa5822bb..7643464fb80 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,9 +14,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop", + optional: false, range: [14, 18], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 6, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: null, @@ -41,9 +48,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -51,6 +62,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 21], diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot index 121e647439e..24c2998c99c 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures declaration ClassDeclaration with-member-one AST Alignment body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,9 +18,13 @@ exports[`AST Fixtures declaration ClassDeclaration with-member-one AST Alignment type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop', +- optional: false, range: [14, 18], loc: { @@ -27,7 +32,9 @@ exports[`AST Fixtures declaration ClassDeclaration with-member-one AST Alignment end: { column: 6, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: null, @@ -45,9 +52,13 @@ exports[`AST Fixtures declaration ClassDeclaration with-member-one AST Alignment end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -55,6 +66,7 @@ exports[`AST Fixtures declaration ClassDeclaration with-member-one AST Alignment end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 21], diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot index 28172433eac..39df284a861 100644 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot @@ -11,7 +11,9 @@ Program { type: "ImportAttribute", key: Identifier { type: "Identifier", + decorators: Array [], name: "type", + optional: false, range: [29, 33], loc: { diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot index 077fe892d33..947c76a3a24 100644 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,75 @@ exports[`AST Fixtures declaration ExportAllDeclaration assertion AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportAllDeclaration { + type: 'ExportAllDeclaration', + assertions: Array [ + ImportAttribute { + type: 'ImportAttribute', + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'type', +- optional: false, + + range: [29, 33], + loc: { + start: { column: 29, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + value: Literal { + type: 'Literal', + raw: '\\\\'json\\\\'', + value: 'json', + + range: [35, 41], + loc: { + start: { column: 35, line: 1 }, + end: { column: 41, line: 1 }, + }, + }, + + range: [29, 41], + loc: { + start: { column: 29, line: 1 }, + end: { column: 41, line: 1 }, + }, + }, + ], + exported: null, + exportKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\\\'mod\\\\'', + value: 'mod', + + range: [14, 19], + loc: { + start: { column: 14, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [0, 44], + loc: { + start: { column: 0, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 45], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/1-TSESTree-AST.shot index 0650677e2f6..8691d8d833a 100644 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/1-TSESTree-AST.shot @@ -9,7 +9,9 @@ Program { assertions: Array [], exported: Identifier { type: "Identifier", + decorators: Array [], name: "mod", + optional: false, range: [12, 15], loc: { diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/5-AST-Alignment-AST.shot index 8aabbae3357..56c645ce776 100644 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,53 @@ exports[`AST Fixtures declaration ExportAllDeclaration named AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportAllDeclaration { + type: 'ExportAllDeclaration', + assertions: Array [], + exported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'mod', +- optional: false, + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + exportKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\\\'module\\\\'', + value: 'module', + + range: [21, 29], + loc: { + start: { column: 21, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/1-TSESTree-AST.shot index bc5b9ffa8c1..1002eb6e018 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/1-TSESTree-AST.shot @@ -8,6 +8,7 @@ Program { type: "ExportDefaultDeclaration", declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -18,7 +19,10 @@ Program { end: { column: 23, line: 1 }, }, }, + declare: false, + decorators: Array [], id: null, + implements: Array [], superClass: null, range: [15, 23], diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/5-AST-Alignment-AST.shot index 6c617458733..27fa552a126 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,54 @@ exports[`AST Fixtures declaration ExportDefaultDeclaration anonymous-class AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportDefaultDeclaration { + type: 'ExportDefaultDeclaration', + declaration: ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, +- declare: false, +- decorators: Array [], + id: null, +- implements: Array [], + superClass: null, + + range: [15, 23], + loc: { + start: { column: 15, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + exportKind: 'value', + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/1-TSESTree-AST.shot index e30c973e4c5..fe82d48ec18 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/1-TSESTree-AST.shot @@ -19,6 +19,7 @@ Program { end: { column: 29, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: null, diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/5-AST-Alignment-AST.shot index 0472fbccb82..5ccd7cf076e 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,54 @@ exports[`AST Fixtures declaration ExportDefaultDeclaration anonymous-function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportDefaultDeclaration { + type: 'ExportDefaultDeclaration', + declaration: FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [27, 29], + loc: { + start: { column: 27, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: null, + params: Array [], + + range: [15, 29], + loc: { + start: { column: 15, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + exportKind: 'value', + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/1-TSESTree-AST.shot index 166a1d77c3d..68d2d08a73f 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/1-TSESTree-AST.shot @@ -8,6 +8,7 @@ Program { type: "ExportDefaultDeclaration", declaration: ClassExpression { type: "ClassExpression", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -18,9 +19,13 @@ Program { end: { column: 28, line: 1 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [22, 25], loc: { @@ -28,6 +33,7 @@ Program { end: { column: 25, line: 1 }, }, }, + implements: Array [], superClass: null, range: [16, 28], diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/5-AST-Alignment-AST.shot index 4d3dd269c49..f49e8ea492d 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,65 @@ exports[`AST Fixtures declaration ExportDefaultDeclaration class-expression AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportDefaultDeclaration { + type: 'ExportDefaultDeclaration', + declaration: ClassExpression { + type: 'ClassExpression', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [26, 28], + loc: { + start: { column: 26, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [22, 25], + loc: { + start: { column: 22, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [16, 28], + loc: { + start: { column: 16, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + exportKind: 'value', + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot index f2ce271ea77..32276d23114 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot @@ -8,6 +8,7 @@ Program { type: "ExportDefaultDeclaration", declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -18,9 +19,13 @@ Program { end: { column: 27, line: 1 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [21, 24], loc: { @@ -28,6 +33,7 @@ Program { end: { column: 24, line: 1 }, }, }, + implements: Array [], superClass: null, range: [15, 27], diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/5-AST-Alignment-AST.shot index 892ae8987da..31cfe8a973e 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,65 @@ exports[`AST Fixtures declaration ExportDefaultDeclaration class AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportDefaultDeclaration { + type: 'ExportDefaultDeclaration', + declaration: ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [25, 27], + loc: { + start: { column: 25, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [15, 27], + loc: { + start: { column: 15, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + exportKind: 'value', + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/1-TSESTree-AST.shot index 59570dbd56d..3475e4fb805 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/1-TSESTree-AST.shot @@ -19,11 +19,14 @@ Program { end: { column: 32, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [24, 27], loc: { diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/5-AST-Alignment-AST.shot index 6e67c16fb8b..d5c74ed1fc0 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,65 @@ exports[`AST Fixtures declaration ExportDefaultDeclaration function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportDefaultDeclaration { + type: 'ExportDefaultDeclaration', + declaration: FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [30, 32], + loc: { + start: { column: 30, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [24, 27], + loc: { + start: { column: 24, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + params: Array [], + + range: [15, 32], + loc: { + start: { column: 15, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + exportKind: 'value', + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/1-TSESTree-AST.shot index 11900ab6838..9afeac442a3 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "ExportDefaultDeclaration", declaration: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [15, 16], loc: { diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/5-AST-Alignment-AST.shot index 1fc84e1257d..5682d50ae12 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,41 @@ exports[`AST Fixtures declaration ExportDefaultDeclaration identifier AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportDefaultDeclaration { + type: 'ExportDefaultDeclaration', + declaration: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + exportKind: 'value', + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/1-TSESTree-AST.shot index 755e1480fde..ca7b222b396 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/1-TSESTree-AST.shot @@ -18,9 +18,13 @@ Program { end: { column: 31, line: 1 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [25, 28], loc: { diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/5-AST-Alignment-AST.shot index 778b30b1513..5818ff75d81 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,62 @@ exports[`AST Fixtures declaration ExportDefaultDeclaration interface AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportDefaultDeclaration { + type: 'ExportDefaultDeclaration', + declaration: TSInterfaceDeclaration { + type: 'TSInterfaceDeclaration', + body: TSInterfaceBody { + type: 'TSInterfaceBody', + body: Array [], + + range: [29, 31], + loc: { + start: { column: 29, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, +- declare: false, +- extends: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [25, 28], + loc: { + start: { column: 25, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + + range: [15, 31], + loc: { + start: { column: 15, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + exportKind: 'value', + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/1-TSESTree-AST.shot index c5593e6762b..9999b76d853 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/1-TSESTree-AST.shot @@ -15,7 +15,9 @@ Program { type: "ExportSpecifier", exported: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [14, 15], loc: { @@ -26,7 +28,9 @@ Program { exportKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [9, 10], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/5-AST-Alignment-AST.shot index 845f2cb5cfb..81487c9bfc1 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/5-AST-Alignment-AST.shot @@ -19,7 +19,9 @@ exports[`AST Fixtures declaration ExportNamedDeclaration aliased AST Alignment - type: 'ExportSpecifier', exported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [14, 15], loc: { @@ -30,7 +32,9 @@ exports[`AST Fixtures declaration ExportNamedDeclaration aliased AST Alignment - exportKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [9, 10], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot index d33d4cd08d4..37bbf2ab102 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot @@ -9,6 +9,7 @@ Program { assertions: Array [], declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -19,9 +20,13 @@ Program { end: { column: 19, line: 1 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [13, 16], loc: { @@ -29,6 +34,7 @@ Program { end: { column: 16, line: 1 }, }, }, + implements: Array [], superClass: null, range: [7, 19], diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/5-AST-Alignment-AST.shot index cb90ab5e0fb..1e08010d64d 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,68 @@ exports[`AST Fixtures declaration ExportNamedDeclaration class AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + assertions: Array [], + declaration: ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [17, 19], + loc: { + start: { column: 17, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [13, 16], + loc: { + start: { column: 13, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [7, 19], + loc: { + start: { column: 7, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + exportKind: 'value', + source: null, + specifiers: Array [], + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/1-TSESTree-AST.shot index e6cd6c4d7a3..a87f2cf3a5d 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/1-TSESTree-AST.shot @@ -15,7 +15,9 @@ Program { generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [24, 27], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/5-AST-Alignment-AST.shot index 9aaae286a11..b1623c4968c 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/5-AST-Alignment-AST.shot @@ -19,7 +19,9 @@ exports[`AST Fixtures declaration ExportNamedDeclaration declare-function AST Al generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [24, 27], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/1-TSESTree-AST.shot index 70f1a5783f9..81f38327c02 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,13 @@ Program { assertions: Array [], declaration: TSEnumDeclaration { type: "TSEnumDeclaration", + const: false, + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [12, 15], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/5-AST-Alignment-AST.shot index 1a21129afb2..cba00ad04c1 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,56 @@ exports[`AST Fixtures declaration ExportNamedDeclaration enum AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + assertions: Array [], + declaration: TSEnumDeclaration { + type: 'TSEnumDeclaration', +- const: false, +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + members: Array [], + + range: [7, 18], + loc: { + start: { column: 7, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + exportKind: 'value', + source: null, + specifiers: Array [], + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/1-TSESTree-AST.shot index ad4118a633c..9ad5b32ef09 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/1-TSESTree-AST.shot @@ -20,11 +20,14 @@ Program { end: { column: 24, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [16, 19], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/5-AST-Alignment-AST.shot index fe318b3ed6f..31a4f289f30 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,68 @@ exports[`AST Fixtures declaration ExportNamedDeclaration function-declaration AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + assertions: Array [], + declaration: FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [22, 24], + loc: { + start: { column: 22, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + params: Array [], + + range: [7, 24], + loc: { + start: { column: 7, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + exportKind: 'value', + source: null, + specifiers: Array [], + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/1-TSESTree-AST.shot index 3a91eb9c252..961e113ada8 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/1-TSESTree-AST.shot @@ -15,7 +15,9 @@ Program { type: "ExportSpecifier", exported: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [9, 10], loc: { @@ -26,7 +28,9 @@ Program { exportKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [9, 10], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/5-AST-Alignment-AST.shot index 240f602618f..d17b88c8cc6 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/5-AST-Alignment-AST.shot @@ -19,7 +19,9 @@ exports[`AST Fixtures declaration ExportNamedDeclaration identifier-braced AST A type: 'ExportSpecifier', exported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [9, 10], loc: { @@ -30,7 +32,9 @@ exports[`AST Fixtures declaration ExportNamedDeclaration identifier-braced AST A exportKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [9, 10], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/1-TSESTree-AST.shot index 4c2fa789c16..b679600c3ac 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/1-TSESTree-AST.shot @@ -15,7 +15,9 @@ Program { type: "ExportSpecifier", exported: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [9, 10], loc: { @@ -26,7 +28,9 @@ Program { exportKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [9, 10], loc: { @@ -45,7 +49,9 @@ Program { type: "ExportSpecifier", exported: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [12, 13], loc: { @@ -56,7 +62,9 @@ Program { exportKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [12, 13], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/5-AST-Alignment-AST.shot index 8d76dc7c571..19de4d0f7c2 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/5-AST-Alignment-AST.shot @@ -19,7 +19,9 @@ exports[`AST Fixtures declaration ExportNamedDeclaration identifier-many AST Ali type: 'ExportSpecifier', exported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [9, 10], loc: { @@ -30,7 +32,9 @@ exports[`AST Fixtures declaration ExportNamedDeclaration identifier-many AST Ali exportKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [9, 10], loc: { @@ -49,7 +53,9 @@ exports[`AST Fixtures declaration ExportNamedDeclaration identifier-many AST Ali type: 'ExportSpecifier', exported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [12, 13], loc: { @@ -60,7 +66,9 @@ exports[`AST Fixtures declaration ExportNamedDeclaration identifier-many AST Ali exportKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [12, 13], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/1-TSESTree-AST.shot index a301d0efca7..fa87e7b81e9 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/1-TSESTree-AST.shot @@ -19,9 +19,13 @@ Program { end: { column: 23, line: 1 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [17, 20], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/5-AST-Alignment-AST.shot index 02ddc518379..4a6ef4e90d4 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/5-AST-Alignment-AST.shot @@ -23,9 +23,13 @@ exports[`AST Fixtures declaration ExportNamedDeclaration interface AST Alignment end: { column: 23, line: 1 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [17, 20], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/1-TSESTree-AST.shot index 70aa834e199..26d7e606ca8 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/1-TSESTree-AST.shot @@ -19,9 +19,13 @@ Program { end: { column: 23, line: 1 }, }, }, + declare: false, + global: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [17, 20], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/5-AST-Alignment-AST.shot index d9b1ab535bb..f2293b94d19 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/5-AST-Alignment-AST.shot @@ -23,9 +23,13 @@ exports[`AST Fixtures declaration ExportNamedDeclaration namespace AST Alignment end: { column: 23, line: 1 }, }, }, +- declare: false, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [17, 20], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/1-TSESTree-AST.shot index 2a6f27ff691..4f908cbe9e4 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { assertions: Array [], declaration: TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [12, 13], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/5-AST-Alignment-AST.shot index db70418e9f1..896628c6482 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures declaration ExportNamedDeclaration type-alias AST Alignmen assertions: Array [], declaration: TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [12, 13], loc: { diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/1-TSESTree-AST.shot index 64a85af7e54..b9e39191619 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/1-TSESTree-AST.shot @@ -12,9 +12,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [13, 14], loc: { @@ -41,6 +44,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [7, 19], diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/5-AST-Alignment-AST.shot index bb45021e9c4..b265b8c947b 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,78 @@ exports[`AST Fixtures declaration ExportNamedDeclaration variable-declaration AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + assertions: Array [], + declaration: VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [13, 18], + loc: { + start: { column: 13, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [7, 19], + loc: { + start: { column: 7, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + exportKind: 'value', + source: null, + specifiers: Array [], + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/1-TSESTree-AST.shot index 7a7cd7ea28a..96a295753f9 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 23, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [15, 18], loc: { diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/5-AST-Alignment-AST.shot index fe3cf227fba..0d134e323b2 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures declaration FunctionDeclaration async AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: true, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + params: Array [], + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot index e21b80de90e..f91fefb612f 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 17, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [9, 12], loc: { diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot index b08265806b5..4d1680384f2 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures declaration FunctionDeclaration empty AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [15, 17], + loc: { + start: { column: 15, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [], + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/1-TSESTree-AST.shot index 7ad2d7a2dce..96f2b929cae 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 18, line: 1 }, }, }, + declare: false, expression: false, generator: true, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [10, 13], loc: { diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/5-AST-Alignment-AST.shot index e94e87d038a..37659c98a4a 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures declaration FunctionDeclaration generator AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [16, 18], + loc: { + start: { column: 16, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, +- declare: false, + expression: false, + generator: true, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + params: Array [], + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/1-TSESTree-AST.shot index 9a6db3d1c4c..a62be20d2f3 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 24, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [9, 12], loc: { @@ -32,7 +35,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [13, 14], loc: { @@ -42,7 +47,9 @@ Program { }, Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [16, 17], loc: { @@ -52,7 +59,9 @@ Program { }, Identifier { type: "Identifier", + decorators: Array [], name: "c", + optional: false, range: [19, 20], loc: { diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot index f8b80c46b1e..8e1fef0e8e0 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,92 @@ exports[`AST Fixtures declaration FunctionDeclaration param-many AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [22, 24], + loc: { + start: { column: 22, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'c', +- optional: false, + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/1-TSESTree-AST.shot index 99d9cdc9e98..adc9b06ff70 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 18, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [9, 12], loc: { @@ -32,7 +35,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [13, 14], loc: { diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot index 5c75a74de72..24d97c68311 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,68 @@ exports[`AST Fixtures declaration FunctionDeclaration param-one AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [16, 18], + loc: { + start: { column: 16, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/1-TSESTree-AST.shot index d9d3eccf8d7..db4980861e7 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 23, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [9, 12], loc: { diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot index d0df21058e9..50df6aa1bbb 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,73 @@ exports[`AST Fixtures declaration FunctionDeclaration returnType AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSVoidKeyword { + type: 'TSVoidKeyword', + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [14, 20], + loc: { + start: { column: 14, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot index 24eae0d3290..69180dcc5a9 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 26, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [9, 12], loc: { @@ -38,7 +41,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [13, 14], loc: { @@ -59,7 +64,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [16, 17], loc: { @@ -80,7 +87,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "V", + optional: false, range: [19, 20], loc: { diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot index 98ace90820f..726103271df 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot @@ -21,11 +21,14 @@ exports[`AST Fixtures declaration FunctionDeclaration type-param-many AST Alignm end: { column: 26, line: 1 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [9, 12], loc: { @@ -42,7 +45,9 @@ exports[`AST Fixtures declaration FunctionDeclaration type-param-many AST Alignm - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [13, 14], - loc: { @@ -64,8 +69,11 @@ exports[`AST Fixtures declaration FunctionDeclaration type-param-many AST Alignm - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', -- +- optional: false, ++ name: 'U', + - range: [16, 17], - loc: { - start: { column: 16, line: 1 }, @@ -73,8 +81,7 @@ exports[`AST Fixtures declaration FunctionDeclaration type-param-many AST Alignm - }, - }, - out: false, -+ name: 'U', - +- range: [16, 17], loc: { start: { column: 16, line: 1 }, @@ -86,7 +93,9 @@ exports[`AST Fixtures declaration FunctionDeclaration type-param-many AST Alignm - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'V', +- optional: false, - - range: [19, 20], - loc: { diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot index b2caab0f05b..7728bf5e746 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 20, line: 1 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [9, 12], loc: { @@ -38,7 +41,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [13, 14], loc: { diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot index b997a40aca3..2aa9e8c922b 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot @@ -21,11 +21,14 @@ exports[`AST Fixtures declaration FunctionDeclaration type-param-one AST Alignme end: { column: 20, line: 1 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [9, 12], loc: { @@ -42,7 +45,9 @@ exports[`AST Fixtures declaration FunctionDeclaration type-param-one AST Alignme - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [13, 14], - loc: { diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/spec.ts b/packages/ast-spec/src/declaration/FunctionDeclaration/spec.ts index 4fe3d2dc693..0ede710628c 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/spec.ts @@ -6,8 +6,7 @@ import type { BlockStatement } from '../../statement/BlockStatement/spec'; interface FunctionDeclarationBase extends FunctionBase { type: AST_NODE_TYPES.FunctionDeclaration; body: BlockStatement; - // TODO(#5020) - make this always `false` if it is not `declare`d instead of `undefined` - declare?: false; + declare: false; expression: false; } diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot index 877884e2c9a..a4bf6d24dde 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot @@ -11,7 +11,9 @@ Program { type: "ImportAttribute", key: Identifier { type: "Identifier", + decorators: Array [], name: "type", + optional: false, range: [34, 38], loc: { @@ -55,7 +57,9 @@ Program { type: "ImportNamespaceSpecifier", local: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [12, 13], loc: { diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot index c7b85e439da..f436b762068 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,97 @@ exports[`AST Fixtures declaration ImportDeclaration assertion AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [ + ImportAttribute { + type: 'ImportAttribute', + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'type', +- optional: false, + + range: [34, 38], + loc: { + start: { column: 34, line: 1 }, + end: { column: 38, line: 1 }, + }, + }, + value: Literal { + type: 'Literal', + raw: '\\\\'json\\\\'', + value: 'json', + + range: [40, 46], + loc: { + start: { column: 40, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + + range: [34, 46], + loc: { + start: { column: 34, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + ], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\\\'mod\\\\'', + value: 'mod', + + range: [19, 24], + loc: { + start: { column: 19, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + specifiers: Array [ + ImportNamespaceSpecifier { + type: 'ImportNamespaceSpecifier', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [7, 13], + loc: { + start: { column: 7, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + + range: [0, 49], + loc: { + start: { column: 0, line: 1 }, + end: { column: 49, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 50], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/1-TSESTree-AST.shot index 3b5e6f5d956..128bab49345 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportDefaultSpecifier", local: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [7, 8], loc: { @@ -43,7 +45,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [12, 13], loc: { @@ -54,7 +58,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [12, 13], loc: { @@ -73,7 +79,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "c", + optional: false, range: [15, 16], loc: { @@ -84,7 +92,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "c", + optional: false, range: [15, 16], loc: { @@ -103,7 +113,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "d", + optional: false, range: [18, 19], loc: { @@ -114,7 +126,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "d", + optional: false, range: [18, 19], loc: { diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/5-AST-Alignment-AST.shot index 5a7d0eb9f83..03e54d7e051 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,166 @@ exports[`AST Fixtures declaration ImportDeclaration default-and-named-many AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\\\'mod\\\\'', + value: 'mod', + + range: [27, 32], + loc: { + start: { column: 27, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: 'ImportDefaultSpecifier', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + ImportSpecifier { + type: 'ImportSpecifier', + imported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + importKind: 'value', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ImportSpecifier { + type: 'ImportSpecifier', + imported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'c', +- optional: false, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + importKind: 'value', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'c', +- optional: false, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ImportSpecifier { + type: 'ImportSpecifier', + imported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'd', +- optional: false, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + importKind: 'value', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'd', +- optional: false, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 34], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/1-TSESTree-AST.shot index 0e94a0b6bb9..3065e8eb00f 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportDefaultSpecifier", local: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [26, 27], loc: { diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/5-AST-Alignment-AST.shot index 77b9d9ec72b..d926e582ed9 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,64 @@ exports[`AST Fixtures declaration ImportDeclaration default-and-named-none AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\\\'mod\\\\'', + value: 'mod', + + range: [37, 42], + loc: { + start: { column: 18, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: 'ImportDefaultSpecifier', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [26, 27], + loc: { + start: { column: 7, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + + range: [26, 27], + loc: { + start: { column: 7, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + ], + + range: [19, 43], + loc: { + start: { column: 0, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + ], + sourceType: 'module', + + range: [19, 44], + loc: { + start: { column: 0, line: 2 }, + end: { column: 0, line: 3 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/1-TSESTree-AST.shot index 362d429e027..fe502b6b0d3 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportDefaultSpecifier", local: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [7, 8], loc: { @@ -43,7 +45,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [12, 13], loc: { @@ -54,7 +58,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [12, 13], loc: { diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/5-AST-Alignment-AST.shot index 8661b6d43b2..0280dbae760 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,98 @@ exports[`AST Fixtures declaration ImportDeclaration default-and-named-one AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\\\'mod\\\\'', + value: 'mod', + + range: [21, 26], + loc: { + start: { column: 21, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: 'ImportDefaultSpecifier', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + ImportSpecifier { + type: 'ImportSpecifier', + imported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + importKind: 'value', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/1-TSESTree-AST.shot index 88c4eac8c15..7e030105805 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportDefaultSpecifier", local: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [7, 8], loc: { @@ -43,7 +45,9 @@ Program { type: "ImportNamespaceSpecifier", local: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [15, 16], loc: { diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/5-AST-Alignment-AST.shot index c975ae69118..2dcdcf88ed5 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,85 @@ exports[`AST Fixtures declaration ImportDeclaration default-and-namespace AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\\\'mod\\\\'', + value: 'mod', + + range: [22, 27], + loc: { + start: { column: 22, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: 'ImportDefaultSpecifier', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + ImportNamespaceSpecifier { + type: 'ImportNamespaceSpecifier', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [10, 16], + loc: { + start: { column: 10, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/1-TSESTree-AST.shot index 8575ecc99e2..e6fe948ca49 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportDefaultSpecifier", local: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [7, 8], loc: { diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/5-AST-Alignment-AST.shot index 2524045a807..f26f750648d 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,64 @@ exports[`AST Fixtures declaration ImportDeclaration default AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\\\'mod\\\\'', + value: 'mod', + + range: [14, 19], + loc: { + start: { column: 14, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: 'ImportDefaultSpecifier', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + ], + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/1-TSESTree-AST.shot index a90f8ca955a..eb4c0dd8130 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [9, 10], loc: { @@ -35,7 +37,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [9, 10], loc: { @@ -54,7 +58,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [12, 13], loc: { @@ -65,7 +71,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [12, 13], loc: { @@ -84,7 +92,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "c", + optional: false, range: [15, 16], loc: { @@ -95,7 +105,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "c", + optional: false, range: [15, 16], loc: { diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/5-AST-Alignment-AST.shot index 3f4b4b678e7..60c608085c4 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,145 @@ exports[`AST Fixtures declaration ImportDeclaration named-many AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\\\'mod\\\\'', + value: 'mod', + + range: [24, 29], + loc: { + start: { column: 24, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + specifiers: Array [ + ImportSpecifier { + type: 'ImportSpecifier', + imported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + importKind: 'value', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + ImportSpecifier { + type: 'ImportSpecifier', + imported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + importKind: 'value', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ImportSpecifier { + type: 'ImportSpecifier', + imported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'c', +- optional: false, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + importKind: 'value', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'c', +- optional: false, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/1-TSESTree-AST.shot index 9030519529e..e510756d52d 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [9, 10], loc: { @@ -35,7 +37,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [9, 10], loc: { diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/5-AST-Alignment-AST.shot index a502907e8f6..9f183659098 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,77 @@ exports[`AST Fixtures declaration ImportDeclaration named-one AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\\\'mod\\\\'', + value: 'mod', + + range: [18, 23], + loc: { + start: { column: 18, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + specifiers: Array [ + ImportSpecifier { + type: 'ImportSpecifier', + imported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + importKind: 'value', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + ], + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: 'module', + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/1-TSESTree-AST.shot index 59ea1f2fa4c..dfc85ae7607 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [17, 20], loc: { diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/5-AST-Alignment-AST.shot index 89f8ab5e347..db8ca71596d 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,45 @@ exports[`AST Fixtures declaration TSDeclareFunction empty AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [], + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/1-TSESTree-AST.shot index ed8b5305792..e25ebf8ff6c 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { generator: true, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [18, 21], loc: { diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/5-AST-Alignment-AST.shot index e5478271a49..f2de95210fa 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,45 @@ exports[`AST Fixtures declaration TSDeclareFunction generator AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, + declare: true, + expression: false, + generator: true, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + params: Array [], + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/1-TSESTree-AST.shot index a7f8479f43a..765afe70a95 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [17, 20], loc: { @@ -23,7 +25,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [21, 22], loc: { @@ -33,7 +37,9 @@ Program { }, Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [24, 25], loc: { @@ -43,7 +49,9 @@ Program { }, Identifier { type: "Identifier", + decorators: Array [], name: "c", + optional: false, range: [27, 28], loc: { diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot index cfed52f085e..a5f9bb2ff41 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,82 @@ exports[`AST Fixtures declaration TSDeclareFunction param-many AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'c', +- optional: false, + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/1-TSESTree-AST.shot index 1f21a6f71f8..11466eba5a3 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [17, 20], loc: { @@ -23,7 +25,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [21, 22], loc: { diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot index 81f8c45d656..45d4a64b961 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,58 @@ exports[`AST Fixtures declaration TSDeclareFunction param-one AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/1-TSESTree-AST.shot index 45e65dbe80a..4fdca5e50ec 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [17, 20], loc: { diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot index bddda38b36f..291cdb6599d 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,63 @@ exports[`AST Fixtures declaration TSDeclareFunction returnType AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSVoidKeyword { + type: 'TSVoidKeyword', + + range: [24, 28], + loc: { + start: { column: 24, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + + range: [22, 28], + loc: { + start: { column: 22, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot index aefd6e905e2..f5f26eb7006 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [17, 20], loc: { @@ -29,7 +31,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [21, 22], loc: { @@ -50,7 +54,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [24, 25], loc: { @@ -71,7 +77,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "V", + optional: false, range: [27, 28], loc: { diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot index 5c07aedab59..8fe3efcd40b 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot @@ -16,7 +16,9 @@ exports[`AST Fixtures declaration TSDeclareFunction type-param-many AST Alignmen generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [17, 20], loc: { @@ -33,7 +35,9 @@ exports[`AST Fixtures declaration TSDeclareFunction type-param-many AST Alignmen - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [21, 22], - loc: { @@ -55,7 +59,9 @@ exports[`AST Fixtures declaration TSDeclareFunction type-param-many AST Alignmen - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [24, 25], - loc: { @@ -77,7 +83,9 @@ exports[`AST Fixtures declaration TSDeclareFunction type-param-many AST Alignmen - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'V', +- optional: false, - - range: [27, 28], - loc: { diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot index 4767a93811c..49e351a22e6 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [17, 20], loc: { @@ -29,7 +31,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [21, 22], loc: { diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot index 6763966b08f..b0d76bffd6e 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot @@ -16,7 +16,9 @@ exports[`AST Fixtures declaration TSDeclareFunction type-param-one AST Alignment generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [17, 20], loc: { @@ -33,7 +35,9 @@ exports[`AST Fixtures declaration TSDeclareFunction type-param-one AST Alignment - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [21, 22], - loc: { diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/1-TSESTree-AST.shot index 5c46a6508af..11e3cf1261b 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/1-TSESTree-AST.shot @@ -7,11 +7,14 @@ Program { TSDeclareFunction { type: "TSDeclareFunction", async: false, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [9, 12], loc: { diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/5-AST-Alignment-AST.shot index 7f5b5b1b141..3de9bc65960 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,63 @@ exports[`AST Fixtures declaration TSDeclareFunction without-declare AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSVoidKeyword { + type: 'TSVoidKeyword', + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [14, 20], + loc: { + start: { column: 14, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/spec.ts b/packages/ast-spec/src/declaration/TSDeclareFunction/spec.ts index ea37a1e874f..50cc07ec424 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/spec.ts +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/spec.ts @@ -5,9 +5,7 @@ import type { BlockStatement } from '../../statement/BlockStatement/spec'; // TODO(#1852) - async + declare are semantically invalid together export interface TSDeclareFunction extends FunctionBase { type: AST_NODE_TYPES.TSDeclareFunction; - // TODO(#1852) - breaking change enforce this is always `null` like `TSEmptyBodyFunctionExpression` - body?: BlockStatement; - // TODO(#5020) - make this always `false` if it is not `declare`d instead of `undefined` - declare?: boolean; + body: BlockStatement | undefined; + declare: boolean; expression: false; } diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/1-TSESTree-AST.shot index 1d59f828b67..c14a66f0983 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/1-TSESTree-AST.shot @@ -7,9 +7,12 @@ Program { TSEnumDeclaration { type: "TSEnumDeclaration", const: true, + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [11, 14], loc: { diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/5-AST-Alignment-AST.shot index 95d4c8f6b4a..c9480e42c3a 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,43 @@ exports[`AST Fixtures declaration TSEnumDeclaration const AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSEnumDeclaration { + type: 'TSEnumDeclaration', + const: true, +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [11, 14], + loc: { + start: { column: 11, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + members: Array [], + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot index 8b742184ed9..07212c2caa2 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot @@ -6,10 +6,13 @@ Program { body: Array [ TSEnumDeclaration { type: "TSEnumDeclaration", + const: false, declare: true, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [13, 16], loc: { diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot index 5085b6b4609..3926e3f88cc 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,43 @@ exports[`AST Fixtures declaration TSEnumDeclaration declare AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSEnumDeclaration { + type: 'TSEnumDeclaration', +- const: false, + declare: true, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [13, 16], + loc: { + start: { column: 13, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + members: Array [], + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot index 85e4f093eb2..f63e5c4ae75 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,13 @@ Program { body: Array [ TSEnumDeclaration { type: "TSEnumDeclaration", + const: false, + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [5, 8], loc: { diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot index 2ce5c714db1..86d2f4844f4 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,43 @@ exports[`AST Fixtures declaration TSEnumDeclaration empty AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSEnumDeclaration { + type: 'TSEnumDeclaration', +- const: false, +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [5, 8], + loc: { + start: { column: 5, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + members: Array [], + + range: [0, 11], + loc: { + start: { column: 0, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot index dc9b0027eed..94bdc25daf6 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,13 @@ Program { body: Array [ TSEnumDeclaration { type: "TSEnumDeclaration", + const: false, + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [5, 8], loc: { @@ -19,9 +23,12 @@ Program { members: Array [ TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [13, 14], loc: { diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot index b707fc5d46b..7137394a11b 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,66 @@ exports[`AST Fixtures declaration TSEnumDeclaration with-member-one AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSEnumDeclaration { + type: 'TSEnumDeclaration', +- const: false, +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [5, 8], + loc: { + start: { column: 5, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + members: Array [ + TSEnumMember { + type: 'TSEnumMember', +- computed: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'A', +- optional: false, + + range: [13, 14], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + + range: [13, 14], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + ], + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSEnumDeclaration/spec.ts index 1152c894f4a..1625063426c 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/spec.ts @@ -11,16 +11,14 @@ export interface TSEnumDeclaration extends BaseNode { * const enum Foo {...} * ``` */ - // TODO(#5020) - make this `false` if it is not `const` - const?: boolean; + const: boolean; /** * Whether this is a `declare`d enum. * ``` * declare enum Foo {...} * ``` */ - // TODO(#5020) - make this `false` if it is not `declare`d - declare?: boolean; + declare: boolean; /** * The enum name. */ diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/1-TSESTree-AST.shot index 7109c2c236f..7c8b8d1a04d 100644 --- a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "TSImportEqualsDeclaration", id: Identifier { type: "Identifier", + decorators: Array [], name: "F", + optional: false, range: [7, 8], loc: { @@ -23,7 +25,9 @@ Program { type: "TSQualifiedName", left: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [11, 12], loc: { @@ -33,7 +37,9 @@ Program { }, right: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [13, 14], loc: { @@ -50,7 +56,9 @@ Program { }, right: Identifier { type: "Identifier", + decorators: Array [], name: "C", + optional: false, range: [15, 16], loc: { diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/5-AST-Alignment-AST.shot index 381cbd538ab..c67dc9cb5da 100644 --- a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/5-AST-Alignment-AST.shot @@ -12,7 +12,9 @@ exports[`AST Fixtures declaration TSImportEqualsDeclaration entity-name-many AST type: 'TSImportEqualsDeclaration', id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'F', +- optional: false, range: [7, 8], loc: { @@ -28,7 +30,9 @@ exports[`AST Fixtures declaration TSImportEqualsDeclaration entity-name-many AST type: 'TSQualifiedName', left: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [11, 12], loc: { @@ -38,7 +42,9 @@ exports[`AST Fixtures declaration TSImportEqualsDeclaration entity-name-many AST }, right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [13, 14], loc: { @@ -55,7 +61,9 @@ exports[`AST Fixtures declaration TSImportEqualsDeclaration entity-name-many AST }, right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [15, 16], loc: { diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/1-TSESTree-AST.shot index 4053336bc98..4ea12c910a8 100644 --- a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "TSImportEqualsDeclaration", id: Identifier { type: "Identifier", + decorators: Array [], name: "F", + optional: false, range: [7, 8], loc: { @@ -19,7 +21,9 @@ Program { importKind: "value", moduleReference: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [11, 12], loc: { diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/5-AST-Alignment-AST.shot index 4989243086f..f86cbe219c4 100644 --- a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/5-AST-Alignment-AST.shot @@ -12,7 +12,9 @@ exports[`AST Fixtures declaration TSImportEqualsDeclaration entity-name-one AST type: 'TSImportEqualsDeclaration', id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'F', +- optional: false, range: [7, 8], loc: { @@ -24,7 +26,9 @@ exports[`AST Fixtures declaration TSImportEqualsDeclaration entity-name-one AST + isExport: false, moduleReference: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [11, 12], loc: { diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/1-TSESTree-AST.shot index c36dc7f14ac..fb37989843c 100644 --- a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "TSImportEqualsDeclaration", id: Identifier { type: "Identifier", + decorators: Array [], name: "F", + optional: false, range: [7, 8], loc: { diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/5-AST-Alignment-AST.shot index 4c496755649..a6a6edf01da 100644 --- a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/5-AST-Alignment-AST.shot @@ -12,7 +12,9 @@ exports[`AST Fixtures declaration TSImportEqualsDeclaration external-module-ref- type: 'TSImportEqualsDeclaration', id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'F', +- optional: false, range: [7, 8], loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot index 501d609a46c..f75a923e311 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot @@ -17,9 +17,12 @@ Program { }, }, declare: true, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "F", + optional: false, range: [18, 19], loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot index c5bfaba693b..f283ed85e49 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,52 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration declare AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSInterfaceDeclaration { + type: 'TSInterfaceDeclaration', + body: TSInterfaceBody { + type: 'TSInterfaceBody', + body: Array [], + + range: [20, 22], + loc: { + start: { column: 20, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + declare: true, +- extends: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'F', +- optional: false, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot index aa7db317692..a76723a4202 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,13 @@ Program { end: { column: 14, line: 1 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "F", + optional: false, range: [10, 11], loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot index 42bc3c4eb68..81a856aecb1 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,52 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration empty AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSInterfaceDeclaration { + type: 'TSInterfaceDeclaration', + body: TSInterfaceBody { + type: 'TSInterfaceBody', + body: Array [], + + range: [12, 14], + loc: { + start: { column: 12, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, +- declare: false, +- extends: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'F', +- optional: false, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/1-TSESTree-AST.shot index 2e08532845c..382ae653723 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/1-TSESTree-AST.shot @@ -16,12 +16,15 @@ Program { end: { column: 30, line: 1 }, }, }, + declare: false, extends: Array [ TSInterfaceHeritage { type: "TSInterfaceHeritage", expression: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [20, 21], loc: { @@ -40,7 +43,9 @@ Program { type: "TSInterfaceHeritage", expression: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [23, 24], loc: { @@ -59,7 +64,9 @@ Program { type: "TSInterfaceHeritage", expression: Identifier { type: "Identifier", + decorators: Array [], name: "C", + optional: false, range: [26, 27], loc: { @@ -77,7 +84,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: Array [], name: "F", + optional: false, range: [10, 11], loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/5-AST-Alignment-AST.shot index 793c00b7e98..5a1f33b4a95 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/5-AST-Alignment-AST.shot @@ -20,6 +20,7 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration extends-many AST Alignm end: { column: 30, line: 1 }, }, }, +- declare: false, extends: Array [ - TSInterfaceHeritage { - type: 'TSInterfaceHeritage', @@ -27,7 +28,9 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration extends-many AST Alignm + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [20, 21], loc: { @@ -48,7 +51,9 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration extends-many AST Alignm + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [23, 24], loc: { @@ -69,7 +74,9 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration extends-many AST Alignm + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [26, 27], loc: { @@ -87,7 +94,9 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration extends-many AST Alignm ], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'F', +- optional: false, range: [10, 11], loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/1-TSESTree-AST.shot index 795dc661bbe..2613dccbcd7 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/1-TSESTree-AST.shot @@ -16,12 +16,15 @@ Program { end: { column: 24, line: 1 }, }, }, + declare: false, extends: Array [ TSInterfaceHeritage { type: "TSInterfaceHeritage", expression: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [20, 21], loc: { @@ -39,7 +42,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: Array [], name: "F", + optional: false, range: [10, 11], loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/5-AST-Alignment-AST.shot index fe6cf12f1a5..a33d62920a1 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/5-AST-Alignment-AST.shot @@ -20,6 +20,7 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration extends-one AST Alignme end: { column: 24, line: 1 }, }, }, +- declare: false, extends: Array [ - TSInterfaceHeritage { - type: 'TSInterfaceHeritage', @@ -27,7 +28,9 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration extends-one AST Alignme + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [20, 21], loc: { @@ -45,7 +48,9 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration extends-one AST Alignme ], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'F', +- optional: false, range: [10, 11], loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot index 6aea3322462..439b8b61589 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,13 @@ Program { end: { column: 23, line: 1 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "F", + optional: false, range: [10, 11], loc: { @@ -34,7 +38,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [12, 13], loc: { @@ -55,7 +61,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [15, 16], loc: { @@ -76,7 +84,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "V", + optional: false, range: [18, 19], loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot index 56e43bd6632..1c04bc51282 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot @@ -20,9 +20,13 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-many AST Ali end: { column: 23, line: 1 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'F', +- optional: false, range: [10, 11], loc: { @@ -38,7 +42,9 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-many AST Ali - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [12, 13], - loc: { @@ -60,7 +66,9 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-many AST Ali - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [15, 16], - loc: { @@ -82,7 +90,9 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-many AST Ali - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'V', +- optional: false, - - range: [18, 19], - loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot index 15f67448566..991f44fcc75 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,13 @@ Program { end: { column: 17, line: 1 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "F", + optional: false, range: [10, 11], loc: { @@ -34,7 +38,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [12, 13], loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot index d6859d52b51..f8638701bcd 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot @@ -20,9 +20,13 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-one AST Alig end: { column: 17, line: 1 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'F', +- optional: false, range: [10, 11], loc: { @@ -38,7 +42,9 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-one AST Alig - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [12, 13], - loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot index 424cf585b19..90d8fa4206d 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop", + optional: false, range: [16, 20], loc: { @@ -22,6 +24,9 @@ Program { end: { column: 6, line: 2 }, }, }, + optional: false, + readonly: false, + static: false, range: [16, 21], loc: { @@ -37,9 +42,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "F", + optional: false, range: [10, 11], loc: { diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot index 8e0b58b2efe..63acdce107d 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,78 @@ exports[`AST Fixtures declaration TSInterfaceDeclaration with-member-one AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSInterfaceDeclaration { + type: 'TSInterfaceDeclaration', + body: TSInterfaceBody { + type: 'TSInterfaceBody', + body: Array [ + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'prop', +- optional: false, + + range: [16, 20], + loc: { + start: { column: 2, line: 2 }, + end: { column: 6, line: 2 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + + range: [16, 21], + loc: { + start: { column: 2, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + ], + + range: [12, 23], + loc: { + start: { column: 12, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, +- declare: false, +- extends: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'F', +- optional: false, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/spec.ts index 18ad9a74155..9a35efc7c15 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/spec.ts @@ -14,19 +14,17 @@ export interface TSInterfaceDeclaration extends BaseNode { /** * Whether the interface was `declare`d, `undefined` otherwise */ - // TODO(#5020) - make this `false` if it is not `declare`d - declare?: boolean; + declare: boolean; /** * The types this interface `extends` */ - extends?: TSInterfaceHeritage[]; + extends: TSInterfaceHeritage[]; /** * The name of this interface */ id: Identifier; /** * The generic type parameters declared for the interface. - * This is `undefined` if there are no generic type parameters declared. */ - typeParameters?: TSTypeParameterDeclaration; + typeParameters: TSTypeParameterDeclaration | undefined; } diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/1-TSESTree-AST.shot index 6d845973deb..5b845981828 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/1-TSESTree-AST.shot @@ -20,7 +20,9 @@ Program { global: true, id: Identifier { type: "Identifier", + decorators: Array [], name: "global", + optional: false, range: [8, 14], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/5-AST-Alignment-AST.shot index 5dc4161ad9a..9fcac3c8efd 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/5-AST-Alignment-AST.shot @@ -24,7 +24,9 @@ exports[`AST Fixtures declaration TSModuleDeclaration global AST Alignment - AST global: true, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'global', +- optional: false, range: [8, 14], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/1-TSESTree-AST.shot index 17f75471076..b978367d602 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/1-TSESTree-AST.shot @@ -7,6 +7,7 @@ Program { TSModuleDeclaration { type: "TSModuleDeclaration", declare: true, + global: false, id: Literal { type: "Literal", raw: "'a'", diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/5-AST-Alignment-AST.shot index 591ea8c8d32..b8fff65dbff 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/5-AST-Alignment-AST.shot @@ -11,6 +11,7 @@ exports[`AST Fixtures declaration TSModuleDeclaration module-declare-no-body AST TSModuleDeclaration { type: 'TSModuleDeclaration', declare: true, +- global: false, id: Literal { type: 'Literal', raw: '\\\\'a\\\\'', diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/1-TSESTree-AST.shot index 026bdc26251..af13ac495f6 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/1-TSESTree-AST.shot @@ -17,9 +17,12 @@ Program { }, }, declare: true, + global: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "F", + optional: false, range: [15, 16], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/5-AST-Alignment-AST.shot index 75dd7304dfa..3fc7f8b34f9 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/5-AST-Alignment-AST.shot @@ -21,9 +21,12 @@ exports[`AST Fixtures declaration TSModuleDeclaration module-declare AST Alignme }, }, declare: true, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'F', +- optional: false, range: [15, 16], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/1-TSESTree-AST.shot index 80f52eaeaa3..1b7ae2bf640 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,13 @@ Program { end: { column: 11, line: 1 }, }, }, + declare: false, + global: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "F", + optional: false, range: [7, 8], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/5-AST-Alignment-AST.shot index 36a5fb1365f..433612e4520 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/5-AST-Alignment-AST.shot @@ -20,9 +20,13 @@ exports[`AST Fixtures declaration TSModuleDeclaration module-id-identifier AST A end: { column: 11, line: 1 }, }, }, +- declare: false, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'F', +- optional: false, range: [7, 8], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/1-TSESTree-AST.shot index 543f49f139c..169d2caaf02 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/1-TSESTree-AST.shot @@ -16,6 +16,8 @@ Program { end: { column: 13, line: 1 }, }, }, + declare: false, + global: false, id: Literal { type: "Literal", raw: "'a'", diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/5-AST-Alignment-AST.shot index 629052e8a65..a5ed2983127 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/5-AST-Alignment-AST.shot @@ -20,6 +20,8 @@ exports[`AST Fixtures declaration TSModuleDeclaration module-id-literal AST Alig end: { column: 13, line: 1 }, }, }, +- declare: false, +- global: false, id: Literal { type: 'Literal', raw: '\\\\'a\\\\'', diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/1-TSESTree-AST.shot index c0f09867e6f..b2218d09fc3 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/1-TSESTree-AST.shot @@ -20,9 +20,13 @@ Program { end: { column: 15, line: 1 }, }, }, + declare: false, + global: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "C", + optional: false, range: [11, 12], loc: { @@ -38,9 +42,13 @@ Program { end: { column: 15, line: 1 }, }, }, + declare: false, + global: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [9, 10], loc: { @@ -56,9 +64,13 @@ Program { end: { column: 15, line: 1 }, }, }, + declare: false, + global: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [7, 8], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/5-AST-Alignment-AST.shot index 9c2311d4b6f..ade25ba03e2 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/5-AST-Alignment-AST.shot @@ -24,9 +24,13 @@ exports[`AST Fixtures declaration TSModuleDeclaration module-id-qualified-name A end: { column: 15, line: 1 }, }, }, +- declare: false, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [11, 12], loc: { @@ -42,9 +46,13 @@ exports[`AST Fixtures declaration TSModuleDeclaration module-id-qualified-name A end: { column: 15, line: 1 }, }, }, +- declare: false, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [9, 10], loc: { @@ -60,9 +68,13 @@ exports[`AST Fixtures declaration TSModuleDeclaration module-id-qualified-name A end: { column: 15, line: 1 }, }, }, +- declare: false, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [7, 8], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/1-TSESTree-AST.shot index d808958c70e..4781289442b 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/1-TSESTree-AST.shot @@ -17,9 +17,12 @@ Program { }, }, declare: true, + global: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "F", + optional: false, range: [18, 19], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/5-AST-Alignment-AST.shot index 48f1c28a6f6..9e710ee89f4 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/5-AST-Alignment-AST.shot @@ -21,9 +21,12 @@ exports[`AST Fixtures declaration TSModuleDeclaration namespace-declare AST Alig }, }, declare: true, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'F', +- optional: false, range: [18, 19], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/1-TSESTree-AST.shot index 05e6c65aa80..765a51745ce 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,13 @@ Program { end: { column: 14, line: 1 }, }, }, + declare: false, + global: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "F", + optional: false, range: [10, 11], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/5-AST-Alignment-AST.shot index 1d16afdfbbb..eeadb154ca4 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/5-AST-Alignment-AST.shot @@ -20,9 +20,13 @@ exports[`AST Fixtures declaration TSModuleDeclaration namespace-id-identifier AS end: { column: 14, line: 1 }, }, }, +- declare: false, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'F', +- optional: false, range: [10, 11], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/1-TSESTree-AST.shot index 895c60ac574..09f8fc851af 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/1-TSESTree-AST.shot @@ -16,13 +16,17 @@ Program { end: { column: 18, line: 1 }, }, }, + declare: false, + global: false, id: TSQualifiedName { type: "TSQualifiedName", left: TSQualifiedName { type: "TSQualifiedName", left: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [10, 11], loc: { @@ -32,7 +36,9 @@ Program { }, right: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [12, 13], loc: { @@ -49,7 +55,9 @@ Program { }, right: Identifier { type: "Identifier", + decorators: Array [], name: "C", + optional: false, range: [14, 15], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/5-AST-Alignment-AST.shot index 21215095129..b3800ab8096 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/5-AST-Alignment-AST.shot @@ -20,13 +20,17 @@ exports[`AST Fixtures declaration TSModuleDeclaration namespace-id-qualified-nam - end: { column: 18, line: 1 }, - }, - }, +- declare: false, +- global: false, - id: TSQualifiedName { - type: 'TSQualifiedName', - left: TSQualifiedName { - type: 'TSQualifiedName', - left: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', +- optional: false, + body: TSModuleDeclaration { + type: 'TSModuleDeclaration', + body: TSModuleDeclaration { @@ -47,7 +51,9 @@ exports[`AST Fixtures declaration TSModuleDeclaration namespace-id-qualified-nam - right: Identifier { + id: Identifier { type: 'Identifier', +- decorators: Array [], - name: 'B', +- optional: false, + name: 'C', - range: [12, 13], @@ -72,7 +78,9 @@ exports[`AST Fixtures declaration TSModuleDeclaration namespace-id-qualified-nam - right: Identifier { + id: Identifier { type: 'Identifier', +- decorators: Array [], - name: 'C', +- optional: false, + name: 'B', - range: [14, 15], diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/1-TSESTree-AST.shot index 34e1101435b..50070d8772c 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/1-TSESTree-AST.shot @@ -16,11 +16,15 @@ Program { end: { column: 20, line: 1 }, }, }, + declare: false, + global: false, id: TSQualifiedName { type: "TSQualifiedName", left: Identifier { type: "Identifier", + decorators: Array [], name: "abd", + optional: false, range: [10, 13], loc: { @@ -30,7 +34,9 @@ Program { }, right: Identifier { type: "Identifier", + decorators: Array [], name: "def", + optional: false, range: [14, 17], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/5-AST-Alignment-AST.shot index 5efa8c2f8b5..47d7105c32d 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-once/snapshots/5-AST-Alignment-AST.shot @@ -20,11 +20,15 @@ exports[`AST Fixtures declaration TSModuleDeclaration namespace-nested-once AST - end: { column: 20, line: 1 }, - }, - }, +- declare: false, +- global: false, - id: TSQualifiedName { - type: 'TSQualifiedName', - left: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'abd', +- optional: false, + body: TSModuleDeclaration { + type: 'TSModuleDeclaration', + body: TSModuleBlock { @@ -43,7 +47,9 @@ exports[`AST Fixtures declaration TSModuleDeclaration namespace-nested-once AST - right: Identifier { + id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'def', +- optional: false, range: [14, 17], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/1-TSESTree-AST.shot index a36e6371322..04967bb7fe9 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/1-TSESTree-AST.shot @@ -16,13 +16,17 @@ Program { end: { column: 24, line: 1 }, }, }, + declare: false, + global: false, id: TSQualifiedName { type: "TSQualifiedName", left: TSQualifiedName { type: "TSQualifiedName", left: Identifier { type: "Identifier", + decorators: Array [], name: "abc", + optional: false, range: [10, 13], loc: { @@ -32,7 +36,9 @@ Program { }, right: Identifier { type: "Identifier", + decorators: Array [], name: "def", + optional: false, range: [14, 17], loc: { @@ -49,7 +55,9 @@ Program { }, right: Identifier { type: "Identifier", + decorators: Array [], name: "ghi", + optional: false, range: [18, 21], loc: { diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/5-AST-Alignment-AST.shot index c7d69187d81..c2b715d7443 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/snapshots/5-AST-Alignment-AST.shot @@ -20,13 +20,17 @@ exports[`AST Fixtures declaration TSModuleDeclaration namespace-nested-twice AST - end: { column: 24, line: 1 }, - }, - }, +- declare: false, +- global: false, - id: TSQualifiedName { - type: 'TSQualifiedName', - left: TSQualifiedName { - type: 'TSQualifiedName', - left: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'abc', +- optional: false, + body: TSModuleDeclaration { + type: 'TSModuleDeclaration', + body: TSModuleDeclaration { @@ -47,7 +51,9 @@ exports[`AST Fixtures declaration TSModuleDeclaration namespace-nested-twice AST - right: Identifier { + id: Identifier { type: 'Identifier', +- decorators: Array [], - name: 'def', +- optional: false, + name: 'ghi', - range: [14, 17], @@ -72,7 +78,9 @@ exports[`AST Fixtures declaration TSModuleDeclaration namespace-nested-twice AST - right: Identifier { + id: Identifier { type: 'Identifier', +- decorators: Array [], - name: 'ghi', +- optional: false, + name: 'def', - range: [18, 21], diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSModuleDeclaration/spec.ts index 84fb5668100..97319591f9e 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/spec.ts @@ -32,15 +32,14 @@ interface TSModuleDeclarationBase extends BaseNode { * ``` */ // TODO - remove this in the next major (we have `.kind` now) - global?: boolean; + global: boolean; /** * Whether the module is `declare`d * ``` * declare namespace F {} * ``` */ - // TODO(#5020) - make this `false` if it is not `declare`d - declare?: boolean; + declare: boolean; /** * The keyword used to define this module declaration @@ -64,9 +63,6 @@ export interface TSModuleDeclarationNamespace extends TSModuleDeclarationBase { id: Identifier | TSQualifiedName; // namespaces must always have a body body: TSModuleBlock; - - // TODO - remove this in the next major (we have `.kind` now) - global?: undefined; } export interface TSModuleDeclarationGlobal extends TSModuleDeclarationBase { @@ -76,18 +72,10 @@ export interface TSModuleDeclarationGlobal extends TSModuleDeclarationBase { body: TSModuleBlock; // this will always be an Identifier with name `global` id: Identifier; - - // note - it's not syntactically required to have `declare`, but it semantically required - - // TODO - remove this in the next major (we have `.kind` now) - global: true; } interface TSModuleDeclarationModuleBase extends TSModuleDeclarationBase { kind: 'module'; - - // TODO - remove this in the next major (we have `.kind` now) - global?: undefined; } export type TSModuleDeclarationModule = diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/1-TSESTree-AST.shot index 914df1fad85..b19984c215f 100644 --- a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "TSNamespaceExportDeclaration", id: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [20, 21], loc: { diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot index 6cd11e1f4b3..21c15688f30 100644 --- a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,40 @@ exports[`AST Fixtures declaration TSNamespaceExportDeclaration valid AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSNamespaceExportDeclaration { + type: 'TSNamespaceExportDeclaration', + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot index 63becdaa218..474b5c7dd88 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot @@ -9,7 +9,9 @@ Program { declare: true, id: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [13, 14], loc: { diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot index 890509a8dcb..253e63408e6 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,61 @@ exports[`AST Fixtures declaration TSTypeAliasDeclaration declare AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', + declare: true, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'T', +- optional: false, + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot index af8a41ed478..6e34b7e37d0 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [5, 6], loc: { @@ -44,7 +47,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [7, 8], loc: { diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot index a80b5aa0a11..d6907099380 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-many AST Ali body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [5, 6], loc: { @@ -48,7 +51,9 @@ exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-many AST Ali - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [7, 8], - loc: { diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot index 6bf2120e61b..bafeb9f8298 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [5, 6], loc: { @@ -44,7 +47,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [7, 8], loc: { @@ -65,7 +70,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "V", + optional: false, range: [10, 11], loc: { @@ -86,7 +93,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "W", + optional: false, range: [13, 14], loc: { diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot index d754f2bf397..f9e09081c6a 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-one AST Alig body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [5, 6], loc: { @@ -48,7 +51,9 @@ exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-one AST Alig - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [7, 8], - loc: { @@ -70,8 +75,11 @@ exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-one AST Alig - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'V', -- +- optional: false, ++ name: 'V', + - range: [10, 11], - loc: { - start: { column: 10, line: 1 }, @@ -79,8 +87,7 @@ exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-one AST Alig - }, - }, - out: false, -+ name: 'V', - +- range: [10, 11], loc: { start: { column: 10, line: 1 }, @@ -92,7 +99,9 @@ exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-one AST Alig - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'W', +- optional: false, - - range: [13, 14], - loc: { diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/1-TSESTree-AST.shot index 424ed29eb52..252b109bbac 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [5, 6], loc: { diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot index 9cc16a451ec..fe331054c0f 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,61 @@ exports[`AST Fixtures declaration TSTypeAliasDeclaration valid AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'T', +- optional: false, + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [0, 11], + loc: { + start: { column: 0, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/spec.ts index 15ab0a40c13..6d7232344b2 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/spec.ts @@ -12,8 +12,7 @@ export interface TSTypeAliasDeclaration extends BaseNode { * declare type T = 1; * ``` */ - // TODO(#5020) - make this `false` if it is not `declare`d - declare?: boolean; + declare: boolean; /** * The name of the type. */ @@ -24,7 +23,6 @@ export interface TSTypeAliasDeclaration extends BaseNode { typeAnnotation: TypeNode; /** * The generic type parameters declared for the type. - * This is `undefined` if there are no generic type parameters declared. */ - typeParameters?: TSTypeParameterDeclaration; + typeParameters: TSTypeParameterDeclaration | undefined; } diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/1-TSESTree-AST.shot index d7290bd926d..4f91419cb04 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [6, 7], loc: { @@ -38,6 +41,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [0, 12], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/5-AST-Alignment-AST.shot index 65c9ece0d43..d997027ffab 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,65 @@ exports[`AST Fixtures declaration VariableDeclaration const-with-value AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [6, 11], + loc: { + start: { column: 6, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/1-TSESTree-AST.shot index ac4cd6b70d8..ce53f114348 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [6, 7], loc: { @@ -38,6 +41,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [0, 12], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/5-AST-Alignment-AST.shot index 56007597c38..077480be9fd 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,65 @@ exports[`AST Fixtures declaration VariableDeclaration const-without-value AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [6, 11], + loc: { + start: { column: 6, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot index 19c59fcc338..64eea0d74fb 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [12, 13], loc: { diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot index 005dc078e1d..87e680ef9a2 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures declaration VariableDeclaration declare AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + init: null, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + declare: true, + kind: 'let', + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/1-TSESTree-AST.shot index a1c7625b457..c85ab81344f 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [4, 5], loc: { @@ -38,6 +41,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [0, 10], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/5-AST-Alignment-AST.shot index 2697799a415..b275669e12a 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,65 @@ exports[`AST Fixtures declaration VariableDeclaration let-with-value AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [4, 9], + loc: { + start: { column: 4, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [0, 10], + loc: { + start: { column: 0, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 11], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/1-TSESTree-AST.shot index 86d5e5fb9d1..e5cc8db17bf 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [4, 5], loc: { @@ -28,6 +31,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [0, 6], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/5-AST-Alignment-AST.shot index 8082a31f808..7df64b552f6 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures declaration VariableDeclaration let-without-value AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + init: null, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/1-TSESTree-AST.shot index f34767c5d50..e02278f0253 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [4, 5], loc: { @@ -29,9 +32,12 @@ Program { }, VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "y", + optional: false, range: [7, 8], loc: { @@ -49,9 +55,12 @@ Program { }, VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "z", + optional: false, range: [10, 11], loc: { @@ -68,6 +77,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [0, 12], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/5-AST-Alignment-AST.shot index 10b9167907c..f7e6ff872f0 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,101 @@ exports[`AST Fixtures declaration VariableDeclaration multiple-declarations AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + init: null, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'y', +- optional: false, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + init: null, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'z', +- optional: false, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + init: null, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/1-TSESTree-AST.shot index d0b455dc1a2..1821c356a1d 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [4, 5], loc: { @@ -38,6 +41,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [0, 10], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/5-AST-Alignment-AST.shot index b107c9499d4..f9ec50b22b4 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,65 @@ exports[`AST Fixtures declaration VariableDeclaration var-with-value AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [4, 9], + loc: { + start: { column: 4, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [0, 10], + loc: { + start: { column: 0, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 11], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/1-TSESTree-AST.shot index 9af840c2c53..6cc3a16f274 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [4, 5], loc: { @@ -28,6 +31,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [0, 6], diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/5-AST-Alignment-AST.shot index b8594239a06..af47a7b5819 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures declaration VariableDeclaration var-without-value AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + init: null, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts b/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts index 4bc9b0f4854..70ed40f52e6 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts @@ -20,8 +20,7 @@ export interface VariableDeclaration extends BaseNode { * declare const x = 1; * ``` */ - // TODO(#5020) - make this `false` if it is not `declare`d - declare?: boolean; + declare: boolean; /** * The keyword used to declare the variable(s) * ``` diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/1-TSESTree-AST.shot index d7ddd69cf47..72e56a80a93 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,6 +14,8 @@ Program { type: "AccessorProperty", computed: true, declare: false, + decorators: Array [], + definite: false, key: BinaryExpression { type: "BinaryExpression", left: Literal { @@ -45,7 +48,9 @@ Program { end: { column: 17, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -73,9 +78,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -83,6 +92,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 37], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/5-AST-Alignment-AST.shot index 029a00e6415..32c9bea08d3 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-complex/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty key-computed-complex AST Alignmen body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,6 +20,8 @@ exports[`AST Fixtures element AccessorProperty key-computed-complex AST Alignmen + type: 'ClassAccessorProperty', computed: true, - declare: false, +- decorators: Array [], +- definite: false, key: BinaryExpression { type: 'BinaryExpression', left: Literal { @@ -51,7 +54,9 @@ exports[`AST Fixtures element AccessorProperty key-computed-complex AST Alignmen end: { column: 17, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -79,9 +84,13 @@ exports[`AST Fixtures element AccessorProperty key-computed-complex AST Alignmen end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -89,6 +98,7 @@ exports[`AST Fixtures element AccessorProperty key-computed-complex AST Alignmen end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 37], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/1-TSESTree-AST.shot index abb1554d8a2..b732b38fcaa 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,6 +14,8 @@ Program { type: "AccessorProperty", computed: true, declare: false, + decorators: Array [], + definite: false, key: Literal { type: "Literal", raw: "1", @@ -24,7 +27,9 @@ Program { end: { column: 13, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -52,9 +57,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -62,6 +71,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 33], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/5-AST-Alignment-AST.shot index bd3b115af80..f4e4e3be0f2 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-number/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty key-computed-number AST Alignment body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,6 +20,8 @@ exports[`AST Fixtures element AccessorProperty key-computed-number AST Alignment + type: 'ClassAccessorProperty', computed: true, - declare: false, +- decorators: Array [], +- definite: false, key: Literal { type: 'Literal', raw: '1', @@ -30,7 +33,9 @@ exports[`AST Fixtures element AccessorProperty key-computed-number AST Alignment end: { column: 13, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -58,9 +63,13 @@ exports[`AST Fixtures element AccessorProperty key-computed-number AST Alignment end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -68,6 +77,7 @@ exports[`AST Fixtures element AccessorProperty key-computed-number AST Alignment end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 33], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/1-TSESTree-AST.shot index 24de40f9aae..1b6c803cccb 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,6 +14,8 @@ Program { type: "AccessorProperty", computed: true, declare: false, + decorators: Array [], + definite: false, key: Literal { type: "Literal", raw: "'prop'", @@ -24,7 +27,9 @@ Program { end: { column: 18, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -52,9 +57,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -62,6 +71,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 44], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/5-AST-Alignment-AST.shot index 3ca8eaf26ea..19306f51f95 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-computed-string/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty key-computed-string AST Alignment body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,6 +20,8 @@ exports[`AST Fixtures element AccessorProperty key-computed-string AST Alignment + type: 'ClassAccessorProperty', computed: true, - declare: false, +- decorators: Array [], +- definite: false, key: Literal { type: 'Literal', raw: '\\\\'prop\\\\'', @@ -30,7 +33,9 @@ exports[`AST Fixtures element AccessorProperty key-computed-string AST Alignment end: { column: 18, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -58,9 +63,13 @@ exports[`AST Fixtures element AccessorProperty key-computed-string AST Alignment end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -68,6 +77,7 @@ exports[`AST Fixtures element AccessorProperty key-computed-string AST Alignment end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 44], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/1-TSESTree-AST.shot index fc451e55245..3d15a804747 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,6 +14,8 @@ Program { type: "AccessorProperty", computed: false, declare: false, + decorators: Array [], + definite: false, key: Literal { type: "Literal", raw: "1", @@ -24,7 +27,9 @@ Program { end: { column: 12, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -52,9 +57,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -62,6 +71,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 31], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/5-AST-Alignment-AST.shot index 77c1ef054cf..632c9be206b 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-number/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty key-number AST Alignment - AST 1` body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,6 +20,8 @@ exports[`AST Fixtures element AccessorProperty key-number AST Alignment - AST 1` + type: 'ClassAccessorProperty', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Literal { type: 'Literal', raw: '1', @@ -30,7 +33,9 @@ exports[`AST Fixtures element AccessorProperty key-number AST Alignment - AST 1` end: { column: 12, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -58,9 +63,13 @@ exports[`AST Fixtures element AccessorProperty key-number AST Alignment - AST 1` end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -68,6 +77,7 @@ exports[`AST Fixtures element AccessorProperty key-number AST Alignment - AST 1` end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 31], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/1-TSESTree-AST.shot index e30dd5e502f..0d9b49ae835 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,6 +14,8 @@ Program { type: "AccessorProperty", computed: false, declare: false, + decorators: Array [], + definite: false, key: PrivateIdentifier { type: "PrivateIdentifier", name: "foo", @@ -23,7 +26,9 @@ Program { end: { column: 15, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -51,9 +56,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -61,6 +70,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 34], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/5-AST-Alignment-AST.shot index 100c519c06c..78ff86db859 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-private/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty key-private AST Alignment - AST 1 body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,6 +20,8 @@ exports[`AST Fixtures element AccessorProperty key-private AST Alignment - AST 1 + type: 'ClassAccessorProperty', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: PrivateIdentifier { type: 'PrivateIdentifier', name: 'foo', @@ -29,7 +32,9 @@ exports[`AST Fixtures element AccessorProperty key-private AST Alignment - AST 1 end: { column: 15, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -57,9 +62,13 @@ exports[`AST Fixtures element AccessorProperty key-private AST Alignment - AST 1 end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -67,6 +76,7 @@ exports[`AST Fixtures element AccessorProperty key-private AST Alignment - AST 1 end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 34], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/1-TSESTree-AST.shot index 1f043b389f8..6fa2ebc8f5f 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,6 +14,8 @@ Program { type: "AccessorProperty", computed: false, declare: false, + decorators: Array [], + definite: false, key: Literal { type: "Literal", raw: "'quoted-prop'", @@ -24,7 +27,9 @@ Program { end: { column: 24, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -52,9 +57,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -62,6 +71,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 49], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/5-AST-Alignment-AST.shot index 20d0e8069fc..43543224020 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/key-string/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty key-string AST Alignment - AST 1` body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,6 +20,8 @@ exports[`AST Fixtures element AccessorProperty key-string AST Alignment - AST 1` + type: 'ClassAccessorProperty', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Literal { type: 'Literal', raw: '\\\\'quoted-prop\\\\'', @@ -30,7 +33,9 @@ exports[`AST Fixtures element AccessorProperty key-string AST Alignment - AST 1` end: { column: 24, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -58,9 +63,13 @@ exports[`AST Fixtures element AccessorProperty key-string AST Alignment - AST 1` end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -68,6 +77,7 @@ exports[`AST Fixtures element AccessorProperty key-string AST Alignment - AST 1` end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 49], 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/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot index 1c8247fb96d..131625db754 100644 --- 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/modifier-abstract-with-value/snapshots/1-TSESTree-AST.shot @@ -14,9 +14,13 @@ Program { type: "TSAbstractAccessorProperty", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [41, 44], loc: { @@ -24,7 +28,9 @@ Program { end: { column: 23, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -60,9 +66,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [15, 18], loc: { @@ -70,6 +80,7 @@ Program { end: { column: 18, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 59], 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/modifier-abstract-with-value/snapshots/5-AST-Alignment-AST.shot index 27b36ea8b18..957a65859f2 100644 --- 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/modifier-abstract-with-value/snapshots/5-AST-Alignment-AST.shot @@ -21,9 +21,13 @@ exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value AST + abstract: true, computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [41, 44], loc: { @@ -31,7 +35,9 @@ exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value AST end: { column: 23, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -49,9 +55,8 @@ exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value AST loc: { start: { column: 23, line: 2 }, end: { column: 31, line: 2 }, - }, - }, -- value: null, ++ }, ++ }, + value: Literal { + type: 'Literal', + raw: '1', @@ -61,8 +66,9 @@ exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value AST + loc: { + start: { column: 34, line: 2 }, + end: { column: 35, line: 2 }, -+ }, -+ }, + }, + }, +- value: null, range: [23, 57], loc: { @@ -78,9 +84,13 @@ exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value AST end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [15, 18], loc: { @@ -88,6 +98,7 @@ exports[`AST Fixtures element AccessorProperty modifier-abstract-with-value AST end: { column: 18, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 59], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/1-TSESTree-AST.shot index 420e13ca4bf..5b7c646dd52 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/1-TSESTree-AST.shot @@ -14,9 +14,13 @@ Program { type: "TSAbstractAccessorProperty", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [41, 44], loc: { @@ -24,7 +28,9 @@ Program { end: { column: 23, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -60,9 +66,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [15, 18], loc: { @@ -70,6 +80,7 @@ Program { end: { column: 18, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 55], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/5-AST-Alignment-AST.shot index cecb46eb91f..b5860513edf 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-abstract/snapshots/5-AST-Alignment-AST.shot @@ -21,9 +21,13 @@ exports[`AST Fixtures element AccessorProperty modifier-abstract AST Alignment - + abstract: true, computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [41, 44], loc: { @@ -31,7 +35,9 @@ exports[`AST Fixtures element AccessorProperty modifier-abstract AST Alignment - end: { column: 23, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -67,9 +73,13 @@ exports[`AST Fixtures element AccessorProperty modifier-abstract AST Alignment - end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [15, 18], loc: { @@ -77,6 +87,7 @@ exports[`AST Fixtures element AccessorProperty modifier-abstract AST Alignment - end: { column: 18, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 55], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/1-TSESTree-AST.shot index 0b61be5984a..4556070e3cd 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,9 +14,13 @@ Program { type: "AccessorProperty", computed: false, declare: true, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [31, 34], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 22, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -59,9 +66,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -69,6 +80,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 45], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/5-AST-Alignment-AST.shot index 76e4314a3c6..806a8428363 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-declare/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty modifier-declare AST Alignment - body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,9 +20,13 @@ exports[`AST Fixtures element AccessorProperty modifier-declare AST Alignment - + type: 'ClassAccessorProperty', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [31, 34], loc: { @@ -29,7 +34,9 @@ exports[`AST Fixtures element AccessorProperty modifier-declare AST Alignment - end: { column: 22, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -65,9 +72,13 @@ exports[`AST Fixtures element AccessorProperty modifier-declare AST Alignment - end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -75,6 +86,7 @@ exports[`AST Fixtures element AccessorProperty modifier-declare AST Alignment - end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 45], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot index b0e78060a09..c8816b3e961 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,9 +14,13 @@ Program { type: "AccessorProperty", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [44, 47], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 23, line: 2 }, }, }, + optional: false, override: true, + readonly: false, static: false, value: Literal { type: "Literal", @@ -51,9 +58,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -61,9 +72,12 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: Identifier { type: "Identifier", + decorators: Array [], name: "Bar", + optional: false, range: [18, 21], loc: { diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/5-AST-Alignment-AST.shot index 7949a056f9a..4586e088951 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-override/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty modifier-override AST Alignment - body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,9 +20,13 @@ exports[`AST Fixtures element AccessorProperty modifier-override AST Alignment - + type: 'ClassAccessorProperty', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [44, 47], loc: { @@ -29,7 +34,9 @@ exports[`AST Fixtures element AccessorProperty modifier-override AST Alignment - end: { column: 23, line: 2 }, }, }, +- optional: false, override: true, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -57,9 +64,13 @@ exports[`AST Fixtures element AccessorProperty modifier-override AST Alignment - end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -67,9 +78,12 @@ exports[`AST Fixtures element AccessorProperty modifier-override AST Alignment - end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [18, 21], loc: { diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/1-TSESTree-AST.shot index 0f0fa0f2a10..e96909134a6 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -14,9 +15,13 @@ Program { accessibility: "private", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [31, 34], loc: { @@ -24,7 +29,9 @@ Program { end: { column: 22, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -52,9 +59,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -62,6 +73,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 41], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/5-AST-Alignment-AST.shot index fd302779cf1..d3111bb3ed9 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-private/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty modifier-private AST Alignment - body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -20,9 +21,13 @@ exports[`AST Fixtures element AccessorProperty modifier-private AST Alignment - accessibility: 'private', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [31, 34], loc: { @@ -30,7 +35,9 @@ exports[`AST Fixtures element AccessorProperty modifier-private AST Alignment - end: { column: 22, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -58,9 +65,13 @@ exports[`AST Fixtures element AccessorProperty modifier-private AST Alignment - end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -68,6 +79,7 @@ exports[`AST Fixtures element AccessorProperty modifier-private AST Alignment - end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 41], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/1-TSESTree-AST.shot index d862c8f8648..5f4807e6d28 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -14,9 +15,13 @@ Program { accessibility: "protected", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [33, 36], loc: { @@ -24,7 +29,9 @@ Program { end: { column: 24, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -52,9 +59,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -62,6 +73,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 43], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/5-AST-Alignment-AST.shot index c26ec2b5985..821908cd72a 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-protected/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty modifier-protected AST Alignment body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -20,9 +21,13 @@ exports[`AST Fixtures element AccessorProperty modifier-protected AST Alignment accessibility: 'protected', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [33, 36], loc: { @@ -30,7 +35,9 @@ exports[`AST Fixtures element AccessorProperty modifier-protected AST Alignment end: { column: 24, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -58,9 +65,13 @@ exports[`AST Fixtures element AccessorProperty modifier-protected AST Alignment end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -68,6 +79,7 @@ exports[`AST Fixtures element AccessorProperty modifier-protected AST Alignment end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 43], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/1-TSESTree-AST.shot index 6a1c4d1b7ec..1122b795bc8 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -14,9 +15,13 @@ Program { accessibility: "public", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [30, 33], loc: { @@ -24,7 +29,9 @@ Program { end: { column: 21, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -52,9 +59,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -62,6 +73,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 40], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/5-AST-Alignment-AST.shot index 9eb4ac8ef9b..b5c95aa7471 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-public/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty modifier-public AST Alignment - A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -20,9 +21,13 @@ exports[`AST Fixtures element AccessorProperty modifier-public AST Alignment - A accessibility: 'public', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [30, 33], loc: { @@ -30,7 +35,9 @@ exports[`AST Fixtures element AccessorProperty modifier-public AST Alignment - A end: { column: 21, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -58,9 +65,13 @@ exports[`AST Fixtures element AccessorProperty modifier-public AST Alignment - A end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -68,6 +79,7 @@ exports[`AST Fixtures element AccessorProperty modifier-public AST Alignment - A end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 40], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/1-TSESTree-AST.shot index 41928f7e572..729514f58a3 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,9 +14,13 @@ Program { type: "AccessorProperty", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [32, 35], loc: { @@ -23,6 +28,7 @@ Program { end: { column: 23, line: 2 }, }, }, + optional: false, override: false, readonly: true, static: false, @@ -52,9 +58,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -62,6 +72,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 42], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/5-AST-Alignment-AST.shot index 7f48bba2e58..1b4e86bf4f6 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-readonly/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty modifier-readonly AST Alignment - body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,9 +20,13 @@ exports[`AST Fixtures element AccessorProperty modifier-readonly AST Alignment - + type: 'ClassAccessorProperty', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [32, 35], loc: { @@ -29,6 +34,7 @@ exports[`AST Fixtures element AccessorProperty modifier-readonly AST Alignment - end: { column: 23, line: 2 }, }, }, +- optional: false, - override: false, readonly: true, static: false, @@ -58,9 +64,13 @@ exports[`AST Fixtures element AccessorProperty modifier-readonly AST Alignment - end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -68,6 +78,7 @@ exports[`AST Fixtures element AccessorProperty modifier-readonly AST Alignment - end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 42], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/1-TSESTree-AST.shot index 6733de847c8..4569d9539f2 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,9 +14,13 @@ Program { type: "AccessorProperty", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [30, 33], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 21, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: true, value: Literal { type: "Literal", @@ -51,9 +58,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -61,6 +72,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 40], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/5-AST-Alignment-AST.shot index c5c6c8589ee..1786d890224 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/modifier-static/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty modifier-static AST Alignment - A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,9 +20,13 @@ exports[`AST Fixtures element AccessorProperty modifier-static AST Alignment - A + type: 'ClassAccessorProperty', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [30, 33], loc: { @@ -29,7 +34,9 @@ exports[`AST Fixtures element AccessorProperty modifier-static AST Alignment - A end: { column: 21, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: true, value: Literal { type: 'Literal', @@ -57,9 +64,13 @@ exports[`AST Fixtures element AccessorProperty modifier-static AST Alignment - A end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -67,6 +78,7 @@ exports[`AST Fixtures element AccessorProperty modifier-static AST Alignment - A end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 40], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/1-TSESTree-AST.shot index a5341fd2f70..72e8429280b 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,9 +14,13 @@ Program { type: "AccessorProperty", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop", + optional: false, range: [23, 27], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 15, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: null, @@ -41,9 +48,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -51,6 +62,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 30], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/5-AST-Alignment-AST.shot index b08e790e91d..000f205df51 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-no-value/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty no-annotation-no-value AST Alignm body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,9 +20,13 @@ exports[`AST Fixtures element AccessorProperty no-annotation-no-value AST Alignm + type: 'ClassAccessorProperty', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop', +- optional: false, range: [23, 27], loc: { @@ -29,7 +34,9 @@ exports[`AST Fixtures element AccessorProperty no-annotation-no-value AST Alignm end: { column: 15, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: null, @@ -47,9 +54,13 @@ exports[`AST Fixtures element AccessorProperty no-annotation-no-value AST Alignm end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -57,6 +68,7 @@ exports[`AST Fixtures element AccessorProperty no-annotation-no-value AST Alignm end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 30], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/1-TSESTree-AST.shot index 0cc63f22486..521e0a423e5 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,9 +14,13 @@ Program { type: "AccessorProperty", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop", + optional: false, range: [23, 27], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 15, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -51,9 +58,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -61,6 +72,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 38], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/5-AST-Alignment-AST.shot index 2d4b943581c..65a2b2405a9 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/no-annotation-with-value/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty no-annotation-with-value AST Alig body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,9 +20,13 @@ exports[`AST Fixtures element AccessorProperty no-annotation-with-value AST Alig + type: 'ClassAccessorProperty', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop', +- optional: false, range: [23, 27], loc: { @@ -29,7 +34,9 @@ exports[`AST Fixtures element AccessorProperty no-annotation-with-value AST Alig end: { column: 15, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -57,9 +64,13 @@ exports[`AST Fixtures element AccessorProperty no-annotation-with-value AST Alig end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -67,6 +78,7 @@ exports[`AST Fixtures element AccessorProperty no-annotation-with-value AST Alig end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 38], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/1-TSESTree-AST.shot index be65f1b2fcd..e12625a5c19 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,9 +14,13 @@ Program { type: "AccessorProperty", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop", + optional: false, range: [23, 27], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 15, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -59,9 +66,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -69,6 +80,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 38], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/5-AST-Alignment-AST.shot index d5ff97f0998..92b38783bb6 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-no-value/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty with-annotation-no-value AST Alig body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,9 +20,13 @@ exports[`AST Fixtures element AccessorProperty with-annotation-no-value AST Alig + type: 'ClassAccessorProperty', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop', +- optional: false, range: [23, 27], loc: { @@ -29,7 +34,9 @@ exports[`AST Fixtures element AccessorProperty with-annotation-no-value AST Alig end: { column: 15, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -65,9 +72,13 @@ exports[`AST Fixtures element AccessorProperty with-annotation-no-value AST Alig end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -75,6 +86,7 @@ exports[`AST Fixtures element AccessorProperty with-annotation-no-value AST Alig end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 38], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/1-TSESTree-AST.shot index 9e9448b46f1..92037bc642b 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,9 +14,13 @@ Program { type: "AccessorProperty", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop", + optional: false, range: [23, 27], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 15, line: 2 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -69,9 +76,13 @@ Program { end: { column: 1, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [6, 9], loc: { @@ -79,6 +90,7 @@ Program { end: { column: 9, line: 1 }, }, }, + implements: Array [], superClass: null, range: [0, 46], diff --git a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/5-AST-Alignment-AST.shot index 0e95b7b4620..aa4208ee99f 100644 --- a/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/element/AccessorProperty/fixtures/with-annotation-with-value/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures element AccessorProperty with-annotation-with-value AST Al body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -19,9 +20,13 @@ exports[`AST Fixtures element AccessorProperty with-annotation-with-value AST Al + type: 'ClassAccessorProperty', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop', +- optional: false, range: [23, 27], loc: { @@ -29,7 +34,9 @@ exports[`AST Fixtures element AccessorProperty with-annotation-with-value AST Al end: { column: 15, line: 2 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -75,9 +82,13 @@ exports[`AST Fixtures element AccessorProperty with-annotation-with-value AST Al end: { column: 1, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [6, 9], loc: { @@ -85,6 +96,7 @@ exports[`AST Fixtures element AccessorProperty with-annotation-with-value AST Al end: { column: 9, line: 1 }, }, }, +- implements: Array [], superClass: null, range: [0, 46], diff --git a/packages/ast-spec/src/element/Property/spec.ts b/packages/ast-spec/src/element/Property/spec.ts index c96a7a26e37..e10b6b46435 100644 --- a/packages/ast-spec/src/element/Property/spec.ts +++ b/packages/ast-spec/src/element/Property/spec.ts @@ -21,7 +21,7 @@ interface PropertyBase extends BaseNode { computed: boolean; method: boolean; shorthand: boolean; - optional?: boolean; + optional: boolean; kind: 'get' | 'init' | 'set'; } diff --git a/packages/ast-spec/src/element/TSEnumMember/spec.ts b/packages/ast-spec/src/element/TSEnumMember/spec.ts index 97d8e49fcd9..9dd1ddeee69 100644 --- a/packages/ast-spec/src/element/TSEnumMember/spec.ts +++ b/packages/ast-spec/src/element/TSEnumMember/spec.ts @@ -11,8 +11,8 @@ interface TSEnumMemberBase extends BaseNode { id: | PropertyNameComputed // this should only happen in semantically invalid code (ts error 1164) | PropertyNameNonComputed; - initializer?: Expression; - computed?: boolean; + initializer: Expression | undefined; + computed: boolean; } /** @@ -33,7 +33,7 @@ export interface TSEnumMemberComputedName extends TSEnumMemberBase { export interface TSEnumMemberNonComputedName extends TSEnumMemberBase { id: PropertyNameNonComputed; - computed?: false; + computed: false; } export type TSEnumMember = diff --git a/packages/ast-spec/src/element/TSIndexSignature/spec.ts b/packages/ast-spec/src/element/TSIndexSignature/spec.ts index 0e102d1b02c..4f514e75714 100644 --- a/packages/ast-spec/src/element/TSIndexSignature/spec.ts +++ b/packages/ast-spec/src/element/TSIndexSignature/spec.ts @@ -7,8 +7,8 @@ import type { Parameter } from '../../unions/Parameter'; export interface TSIndexSignature extends BaseNode { type: AST_NODE_TYPES.TSIndexSignature; parameters: Parameter[]; - typeAnnotation?: TSTypeAnnotation; - readonly?: boolean; - accessibility?: Accessibility; - static?: boolean; + typeAnnotation: TSTypeAnnotation | undefined; + readonly: boolean; + accessibility: Accessibility | undefined; + static: boolean; } diff --git a/packages/ast-spec/src/element/TSMethodSignature/spec.ts b/packages/ast-spec/src/element/TSMethodSignature/spec.ts index 545733ca944..9f75ee603c9 100644 --- a/packages/ast-spec/src/element/TSMethodSignature/spec.ts +++ b/packages/ast-spec/src/element/TSMethodSignature/spec.ts @@ -12,16 +12,16 @@ import type { interface TSMethodSignatureBase extends BaseNode { type: AST_NODE_TYPES.TSMethodSignature; - key: PropertyName; + accessibility: Accessibility | undefined; computed: boolean; - params: Parameter[]; - optional?: boolean; - returnType?: TSTypeAnnotation; - readonly?: boolean; - typeParameters?: TSTypeParameterDeclaration; - accessibility?: Accessibility; - static?: boolean; + key: PropertyName; kind: 'get' | 'method' | 'set'; + optional: boolean; + params: Parameter[]; + readonly: boolean; + returnType: TSTypeAnnotation | undefined; + static: boolean; + typeParameters: TSTypeParameterDeclaration | undefined; } export interface TSMethodSignatureComputedName extends TSMethodSignatureBase { diff --git a/packages/ast-spec/src/element/TSPropertySignature/spec.ts b/packages/ast-spec/src/element/TSPropertySignature/spec.ts index 793e479939e..e695085ca40 100644 --- a/packages/ast-spec/src/element/TSPropertySignature/spec.ts +++ b/packages/ast-spec/src/element/TSPropertySignature/spec.ts @@ -11,12 +11,12 @@ import type { interface TSPropertySignatureBase extends BaseNode { type: AST_NODE_TYPES.TSPropertySignature; key: PropertyName; - optional?: boolean; + optional: boolean; computed: boolean; - typeAnnotation?: TSTypeAnnotation; - readonly?: boolean; - static?: boolean; - accessibility?: Accessibility; + typeAnnotation: TSTypeAnnotation | undefined; + readonly: boolean; + static: boolean; + accessibility: Accessibility | undefined; } export interface TSPropertySignatureComputedName diff --git a/packages/ast-spec/src/expression/ArrowFunctionExpression/spec.ts b/packages/ast-spec/src/expression/ArrowFunctionExpression/spec.ts index 347ee854137..8532636554a 100644 --- a/packages/ast-spec/src/expression/ArrowFunctionExpression/spec.ts +++ b/packages/ast-spec/src/expression/ArrowFunctionExpression/spec.ts @@ -14,6 +14,6 @@ export interface ArrowFunctionExpression extends BaseNode { body: BlockStatement | Expression; async: boolean; expression: boolean; - returnType?: TSTypeAnnotation; - typeParameters?: TSTypeParameterDeclaration; + returnType: TSTypeAnnotation | undefined; + typeParameters: TSTypeParameterDeclaration | undefined; } diff --git a/packages/ast-spec/src/expression/CallExpression/spec.ts b/packages/ast-spec/src/expression/CallExpression/spec.ts index bfe6e8d8d90..b7569c9892e 100644 --- a/packages/ast-spec/src/expression/CallExpression/spec.ts +++ b/packages/ast-spec/src/expression/CallExpression/spec.ts @@ -8,10 +8,10 @@ export interface CallExpression extends BaseNode { type: AST_NODE_TYPES.CallExpression; callee: LeftHandSideExpression; arguments: CallExpressionArgument[]; - typeArguments?: TSTypeParameterInstantiation; + typeArguments: TSTypeParameterInstantiation | undefined; /** @deprecated Use {@link `typeArguments`} instead. */ - typeParameters?: TSTypeParameterInstantiation; + typeParameters: TSTypeParameterInstantiation | undefined; optional: boolean; } diff --git a/packages/ast-spec/src/expression/ClassExpression/spec.ts b/packages/ast-spec/src/expression/ClassExpression/spec.ts index dfe6c0d1b41..dbd4936f67c 100644 --- a/packages/ast-spec/src/expression/ClassExpression/spec.ts +++ b/packages/ast-spec/src/expression/ClassExpression/spec.ts @@ -3,7 +3,7 @@ import type { ClassBase } from '../../base/ClassBase'; export interface ClassExpression extends ClassBase { type: AST_NODE_TYPES.ClassExpression; - abstract?: undefined; - declare?: undefined; - decorators?: undefined; + abstract: false; + declare: false; + decorators: []; } diff --git a/packages/ast-spec/src/expression/Identifier/spec.ts b/packages/ast-spec/src/expression/Identifier/spec.ts index 384922a061a..d18ba7b9b99 100644 --- a/packages/ast-spec/src/expression/Identifier/spec.ts +++ b/packages/ast-spec/src/expression/Identifier/spec.ts @@ -6,7 +6,7 @@ import type { TSTypeAnnotation } from '../../special/TSTypeAnnotation/spec'; export interface Identifier extends BaseNode { type: AST_NODE_TYPES.Identifier; name: string; - typeAnnotation?: TSTypeAnnotation; - optional?: boolean; - decorators?: Decorator[]; + typeAnnotation: TSTypeAnnotation | undefined; + optional: boolean; + decorators: Decorator[]; } diff --git a/packages/ast-spec/src/expression/NewExpression/spec.ts b/packages/ast-spec/src/expression/NewExpression/spec.ts index dc0956c24a6..51aea284158 100644 --- a/packages/ast-spec/src/expression/NewExpression/spec.ts +++ b/packages/ast-spec/src/expression/NewExpression/spec.ts @@ -8,8 +8,8 @@ export interface NewExpression extends BaseNode { type: AST_NODE_TYPES.NewExpression; callee: LeftHandSideExpression; arguments: CallExpressionArgument[]; - typeArguments?: TSTypeParameterInstantiation; + typeArguments: TSTypeParameterInstantiation | undefined; /** @deprecated Use {@link `typeArguments`} instead. */ - typeParameters?: TSTypeParameterInstantiation; + typeParameters: TSTypeParameterInstantiation | undefined; } diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/1-TSESTree-AST.shot index 508caf4b944..0bdfeb5aa60 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { type: "TSSatisfiesExpression", expression: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [0, 3], loc: { @@ -24,7 +26,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [14, 17], loc: { @@ -50,7 +54,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "baz", + optional: false, range: [28, 31], loc: { diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/5-AST-Alignment-AST.shot index 0d7d689095e..c3381385760 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/chained-satisfies/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,100 @@ exports[`AST Fixtures expression TSSatisfiesExpression chained-satisfies AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'baz', +- optional: false, + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [28, 31], + loc: { + start: { column: 28, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/1-TSESTree-AST.shot index bb649ea977d..ecdb83c7809 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/1-TSESTree-AST.shot @@ -50,7 +50,9 @@ Program { }, test: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [0, 3], loc: { diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/5-AST-Alignment-AST.shot index a35b55978ba..b8284df201f 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,89 @@ exports[`AST Fixtures expression TSSatisfiesExpression conditional-no-parentheses AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ConditionalExpression { + type: 'ConditionalExpression', + alternate: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: Literal { + type: 'Literal', + raw: '0', + value: 0, + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [23, 29], + loc: { + start: { column: 23, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [11, 29], + loc: { + start: { column: 11, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + consequent: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + test: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/1-TSESTree-AST.shot index 2194d921890..af5b71d976d 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/1-TSESTree-AST.shot @@ -34,7 +34,9 @@ Program { }, test: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [1, 4], loc: { diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/5-AST-Alignment-AST.shot index 45e35dfc272..8d2c36f9f1a 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,89 @@ exports[`AST Fixtures expression TSSatisfiesExpression conditional-with-parentheses AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: ConditionalExpression { + type: 'ConditionalExpression', + alternate: Literal { + type: 'Literal', + raw: '0', + value: 0, + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + consequent: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + test: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [1, 4], + loc: { + start: { column: 1, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + + range: [1, 12], + loc: { + start: { column: 1, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [24, 30], + loc: { + start: { column: 24, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/1-TSESTree-AST.shot index 7b7bb15a5af..93148e4e73e 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/1-TSESTree-AST.shot @@ -10,7 +10,9 @@ Program { type: "TSSatisfiesExpression", expression: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [0, 3], loc: { diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/5-AST-Alignment-AST.shot index c167cbcb46b..caa4c4e0517 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-keyword/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,58 @@ exports[`AST Fixtures expression TSSatisfiesExpression identifier-keyword AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSBooleanKeyword { + type: 'TSBooleanKeyword', + + range: [14, 21], + loc: { + start: { column: 14, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/1-TSESTree-AST.shot index 6197262c7a0..bd71b31739d 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/1-TSESTree-AST.shot @@ -10,7 +10,9 @@ Program { type: "TSSatisfiesExpression", expression: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [0, 3], loc: { @@ -26,7 +28,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop", + optional: false, range: [16, 20], loc: { @@ -34,6 +38,9 @@ Program { end: { column: 20, line: 1 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSLiteralType { diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/5-AST-Alignment-AST.shot index 8e025552275..f01af1b6d5e 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-object-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,114 @@ exports[`AST Fixtures expression TSSatisfiesExpression identifier-object-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: 'TSTypeLiteral', + members: Array [ + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'prop', +- optional: false, + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: '\\\\'value\\\\'', + value: 'value', + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [20, 29], + loc: { + start: { column: 20, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [16, 29], + loc: { + start: { column: 16, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + ], + + range: [14, 31], + loc: { + start: { column: 14, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + + range: [0, 32], + loc: { + start: { column: 0, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/1-TSESTree-AST.shot index 57c80c5a805..94891e7290c 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/1-TSESTree-AST.shot @@ -10,7 +10,9 @@ Program { type: "TSSatisfiesExpression", expression: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [0, 3], loc: { diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/5-AST-Alignment-AST.shot index eb993d611eb..9d2bc98de48 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,120 @@ exports[`AST Fixtures expression TSSatisfiesExpression identifier-tuple-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + typeAnnotation: TSTupleType { + type: 'TSTupleType', + elementTypes: Array [ + TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + + range: [14, 23], + loc: { + start: { column: 14, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/1-TSESTree-AST.shot index 1ad1131264a..b4e34c9e647 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/1-TSESTree-AST.shot @@ -10,7 +10,9 @@ Program { type: "BinaryExpression", left: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [0, 3], loc: { diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/5-AST-Alignment-AST.shot index a21b35204c9..7d464b640eb 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,79 @@ exports[`AST Fixtures expression TSSatisfiesExpression logical-no-parentheses AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: BinaryExpression { + type: 'BinaryExpression', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + operator: '===', + right: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [9, 27], + loc: { + start: { column: 9, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/1-TSESTree-AST.shot index 4401893b67e..a69b07ee1c2 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { type: "BinaryExpression", left: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [1, 4], loc: { diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/5-AST-Alignment-AST.shot index 28594822212..d616143c031 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,79 @@ exports[`AST Fixtures expression TSSatisfiesExpression logical-with-parentheses AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: BinaryExpression { + type: 'BinaryExpression', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [1, 4], + loc: { + start: { column: 1, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + operator: '===', + right: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [1, 10], + loc: { + start: { column: 1, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + typeAnnotation: TSBooleanKeyword { + type: 'TSBooleanKeyword', + + range: [22, 29], + loc: { + start: { column: 22, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/1-TSESTree-AST.shot index 1ed0e662a99..9691aa90d27 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/1-TSESTree-AST.shot @@ -16,7 +16,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop", + optional: false, range: [3, 7], loc: { @@ -26,6 +28,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: Literal { type: "Literal", @@ -61,7 +64,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop", + optional: false, range: [33, 37], loc: { @@ -69,6 +74,9 @@ Program { end: { column: 37, line: 1 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/5-AST-Alignment-AST.shot index bad308efe92..9acf169a662 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,139 @@ exports[`AST Fixtures expression TSSatisfiesExpression object-object-inner-parentheses AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'prop', +- optional: false, + + range: [3, 7], + loc: { + start: { column: 3, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: Literal { + type: 'Literal', + raw: '\\\\'string\\\\'', + value: 'string', + + range: [9, 17], + loc: { + start: { column: 9, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [3, 17], + loc: { + start: { column: 3, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + + range: [1, 19], + loc: { + start: { column: 1, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: 'TSTypeLiteral', + members: Array [ + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'prop', +- optional: false, + + range: [33, 37], + loc: { + start: { column: 33, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [39, 45], + loc: { + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + + range: [37, 45], + loc: { + start: { column: 37, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + + range: [33, 45], + loc: { + start: { column: 33, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + ], + + range: [31, 47], + loc: { + start: { column: 31, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + + range: [0, 47], + loc: { + start: { column: 0, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + + range: [0, 48], + loc: { + start: { column: 0, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 49], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/1-TSESTree-AST.shot index 49630c4840f..bd3dfc1ec5f 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/1-TSESTree-AST.shot @@ -16,7 +16,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop", + optional: false, range: [3, 7], loc: { @@ -26,6 +28,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: Literal { type: "Literal", @@ -61,7 +64,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop", + optional: false, range: [33, 37], loc: { @@ -69,6 +74,9 @@ Program { end: { column: 37, line: 1 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { diff --git a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/5-AST-Alignment-AST.shot index 982ccda73a2..cad9f0bac09 100644 --- a/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,139 @@ exports[`AST Fixtures expression TSSatisfiesExpression object-object-outer-parentheses AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSSatisfiesExpression { + type: 'TSSatisfiesExpression', + expression: ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'prop', +- optional: false, + + range: [3, 7], + loc: { + start: { column: 3, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: Literal { + type: 'Literal', + raw: '\\\\'string\\\\'', + value: 'string', + + range: [9, 17], + loc: { + start: { column: 9, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [3, 17], + loc: { + start: { column: 3, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + + range: [1, 19], + loc: { + start: { column: 1, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: 'TSTypeLiteral', + members: Array [ + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'prop', +- optional: false, + + range: [33, 37], + loc: { + start: { column: 33, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [39, 45], + loc: { + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + + range: [37, 45], + loc: { + start: { column: 37, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + + range: [33, 45], + loc: { + start: { column: 33, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + ], + + range: [31, 47], + loc: { + start: { column: 31, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + + range: [0, 47], + loc: { + start: { column: 0, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + + range: [0, 48], + loc: { + start: { column: 0, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 49], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" `; diff --git a/packages/ast-spec/src/expression/TaggedTemplateExpression/spec.ts b/packages/ast-spec/src/expression/TaggedTemplateExpression/spec.ts index 8bac918f4ca..b673ca5f0db 100644 --- a/packages/ast-spec/src/expression/TaggedTemplateExpression/spec.ts +++ b/packages/ast-spec/src/expression/TaggedTemplateExpression/spec.ts @@ -6,10 +6,10 @@ import type { TemplateLiteral } from '../TemplateLiteral/spec'; export interface TaggedTemplateExpression extends BaseNode { type: AST_NODE_TYPES.TaggedTemplateExpression; - typeArguments?: TSTypeParameterInstantiation; + typeArguments: TSTypeParameterInstantiation | undefined; /** @deprecated Use {@link `typeArguments`} instead. */ - typeParameters?: TSTypeParameterInstantiation; + typeParameters: TSTypeParameterInstantiation | undefined; tag: LeftHandSideExpression; quasi: TemplateLiteral; diff --git a/packages/ast-spec/src/expression/YieldExpression/spec.ts b/packages/ast-spec/src/expression/YieldExpression/spec.ts index 1f07e4f78e3..00c64731e73 100644 --- a/packages/ast-spec/src/expression/YieldExpression/spec.ts +++ b/packages/ast-spec/src/expression/YieldExpression/spec.ts @@ -5,5 +5,5 @@ import type { Expression } from '../../unions/Expression'; export interface YieldExpression extends BaseNode { type: AST_NODE_TYPES.YieldExpression; delegate: boolean; - argument?: Expression; + argument: Expression | undefined; } diff --git a/packages/ast-spec/src/jsx/JSXOpeningElement/spec.ts b/packages/ast-spec/src/jsx/JSXOpeningElement/spec.ts index d589842df98..1c4ca8af452 100644 --- a/packages/ast-spec/src/jsx/JSXOpeningElement/spec.ts +++ b/packages/ast-spec/src/jsx/JSXOpeningElement/spec.ts @@ -7,10 +7,10 @@ import type { JSXSpreadAttribute } from '../JSXSpreadAttribute/spec'; export interface JSXOpeningElement extends BaseNode { type: AST_NODE_TYPES.JSXOpeningElement; - typeArguments?: TSTypeParameterInstantiation; + typeArguments: TSTypeParameterInstantiation | undefined; /** @deprecated Use {@link `typeArguments`} instead. */ - typeParameters?: TSTypeParameterInstantiation; + typeParameters: TSTypeParameterInstantiation | undefined; selfClosing: boolean; name: JSXTagNameExpression; diff --git a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot index 0a2043175ad..0d768b287bf 100644 --- a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -32,7 +33,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: Array [], name: "configurable", + optional: false, range: [90, 102], loc: { @@ -58,7 +61,9 @@ Program { ], key: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [116, 117], loc: { @@ -67,6 +72,7 @@ Program { }, }, kind: "get", + optional: false, override: false, static: false, value: FunctionExpression { @@ -92,7 +98,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "_x", + optional: false, range: [138, 140], loc: { @@ -122,6 +130,7 @@ Program { end: { column: 3, line: 7 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -148,9 +157,13 @@ Program { end: { column: 1, line: 8 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Point", + optional: false, range: [79, 84], loc: { @@ -158,6 +171,7 @@ Program { end: { column: 11, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 147], diff --git a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot index ef60deece6e..3e8af6cefa6 100644 --- a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -36,7 +37,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'configurable', +- optional: false, range: [90, 102], loc: { @@ -62,7 +65,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac ], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, range: [116, 117], loc: { @@ -71,6 +76,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac }, }, kind: 'get', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -96,7 +102,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: '_x', +- optional: false, range: [138, 140], loc: { @@ -126,6 +134,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac end: { column: 3, line: 7 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -152,9 +161,13 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac end: { column: 1, line: 8 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Point', +- optional: false, range: [79, 84], loc: { @@ -162,6 +175,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac end: { column: 11, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 147], diff --git a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot index a80f43128bf..8aeba5b7c68 100644 --- a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -26,7 +27,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "baz", + optional: false, range: [96, 99], loc: { @@ -36,6 +39,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: Literal { type: "Literal", @@ -66,7 +70,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [90, 93], loc: { @@ -92,7 +98,9 @@ Program { ], key: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [122, 125], loc: { @@ -101,6 +109,7 @@ Program { }, }, kind: "get", + optional: false, override: false, static: true, value: FunctionExpression { @@ -126,7 +135,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "_bar", + optional: false, range: [146, 150], loc: { @@ -156,6 +167,7 @@ Program { end: { column: 3, line: 7 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -182,9 +194,13 @@ Program { end: { column: 1, line: 8 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Other", + optional: false, range: [79, 84], loc: { @@ -192,6 +208,7 @@ Program { end: { column: 11, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 157], diff --git a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot index 3235fe1f39e..2689d71f89b 100644 --- a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -30,7 +31,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [96, 99], loc: { @@ -40,6 +43,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac }, kind: 'init', method: false, +- optional: false, shorthand: false, value: Literal { type: 'Literal', @@ -70,7 +74,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [90, 93], loc: { @@ -96,7 +102,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac ], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [122, 125], loc: { @@ -105,6 +113,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac }, }, kind: 'get', +- optional: false, - override: false, static: true, value: FunctionExpression { @@ -130,7 +139,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: '_bar', +- optional: false, range: [146, 150], loc: { @@ -160,6 +171,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac end: { column: 3, line: 7 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -186,9 +198,13 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac end: { column: 1, line: 8 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Other', +- optional: false, range: [79, 84], loc: { @@ -196,6 +212,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-fac end: { column: 11, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 157], diff --git a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-instance-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-instance-member/snapshots/1-TSESTree-AST.shot index feac827e485..3ac859ca10a 100644 --- a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-instance-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-instance-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -17,7 +18,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: Array [], name: "hidden", + optional: false, range: [86, 92], loc: { @@ -35,7 +38,9 @@ Program { ], key: Identifier { type: "Identifier", + decorators: Array [], name: "z", + optional: false, range: [99, 100], loc: { @@ -44,6 +49,7 @@ Program { }, }, kind: "get", + optional: false, override: false, static: false, value: FunctionExpression { @@ -69,7 +75,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "_z", + optional: false, range: [121, 123], loc: { @@ -99,6 +107,7 @@ Program { end: { column: 3, line: 7 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -125,9 +134,13 @@ Program { end: { column: 1, line: 8 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "P", + optional: false, range: [79, 80], loc: { @@ -135,6 +148,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 130], diff --git a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot index 41706b97b2e..3f92666a625 100644 --- a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-ins body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -21,7 +22,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-ins type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'hidden', +- optional: false, range: [86, 92], loc: { @@ -39,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-ins ], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'z', +- optional: false, range: [99, 100], loc: { @@ -48,6 +53,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-ins }, }, kind: 'get', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -73,7 +79,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-ins optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: '_z', +- optional: false, range: [121, 123], loc: { @@ -103,6 +111,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-ins end: { column: 3, line: 7 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -129,9 +138,13 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-ins end: { column: 1, line: 8 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'P', +- optional: false, range: [79, 80], loc: { @@ -139,6 +152,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-ins end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 130], diff --git a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-static-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-static-member/snapshots/1-TSESTree-AST.shot index 726459cbffe..88f0e315e50 100644 --- a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-static-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-static-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -17,7 +18,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: Array [], name: "adminonly", + optional: false, range: [89, 98], loc: { @@ -35,7 +38,9 @@ Program { ], key: Identifier { type: "Identifier", + decorators: Array [], name: "y", + optional: false, range: [112, 113], loc: { @@ -44,6 +49,7 @@ Program { }, }, kind: "set", + optional: false, override: false, static: true, value: FunctionExpression { @@ -71,7 +77,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "_y", + optional: false, range: [128, 130], loc: { @@ -89,7 +97,9 @@ Program { operator: "=", right: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [133, 134], loc: { @@ -119,13 +129,16 @@ Program { end: { column: 3, line: 7 }, }, }, + declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [114, 115], loc: { @@ -156,9 +169,13 @@ Program { end: { column: 1, line: 8 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "User", + optional: false, range: [79, 83], loc: { @@ -166,6 +183,7 @@ Program { end: { column: 10, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 141], diff --git a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-static-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-static-member/snapshots/5-AST-Alignment-AST.shot index 1ca322e0c3f..019fc0221c8 100644 --- a/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-static-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-static-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-sta body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -21,7 +22,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-sta type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'adminonly', +- optional: false, range: [89, 98], loc: { @@ -39,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-sta ], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'y', +- optional: false, range: [112, 113], loc: { @@ -48,6 +53,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-sta }, }, kind: 'set', +- optional: false, - override: false, static: true, value: FunctionExpression { @@ -75,7 +81,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-sta optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: '_y', +- optional: false, range: [128, 130], loc: { @@ -93,7 +101,9 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-sta operator: '=', right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [133, 134], loc: { @@ -123,13 +133,16 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-sta end: { column: 3, line: 7 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [114, 115], loc: { @@ -160,9 +173,13 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-sta end: { column: 1, line: 8 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'User', +- optional: false, range: [79, 83], loc: { @@ -170,6 +187,7 @@ exports[`AST Fixtures legacy-fixtures accessor-decorators accessor-decorator-sta end: { column: 10, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 141], diff --git a/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameter-whitespace-loc/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameter-whitespace-loc/snapshots/1-TSESTree-AST.shot index 5e87232cc31..70044ff2707 100644 --- a/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameter-whitespace-loc/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameter-whitespace-loc/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 18, line: 3 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "f", + optional: false, range: [82, 83], loc: { @@ -38,7 +41,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [84, 85], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameter-whitespace-loc/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameter-whitespace-loc/snapshots/5-AST-Alignment-AST.shot index 546c2e3fa6b..f4d37746cc1 100644 --- a/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameter-whitespace-loc/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameter-whitespace-loc/snapshots/5-AST-Alignment-AST.shot @@ -21,11 +21,14 @@ exports[`AST Fixtures legacy-fixtures babylon-convergence type-parameter-whitesp end: { column: 18, line: 3 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'f', +- optional: false, range: [82, 83], loc: { @@ -42,7 +45,9 @@ exports[`AST Fixtures legacy-fixtures babylon-convergence type-parameter-whitesp - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [84, 85], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameters/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameters/snapshots/1-TSESTree-AST.shot index 7612bfb5dbd..7e85973529b 100644 --- a/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameters/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameters/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 42, line: 3 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "f", + optional: false, range: [82, 83], loc: { @@ -56,7 +59,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [84, 85], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameters/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameters/snapshots/5-AST-Alignment-AST.shot index 6a4e1eb30bf..148bcde7044 100644 --- a/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameters/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/babylon-convergence/fixtures/type-parameters/snapshots/5-AST-Alignment-AST.shot @@ -21,11 +21,14 @@ exports[`AST Fixtures legacy-fixtures babylon-convergence type-parameters AST Al end: { column: 42, line: 3 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'f', +- optional: false, range: [82, 83], loc: { @@ -60,7 +63,9 @@ exports[`AST Fixtures legacy-fixtures babylon-convergence type-parameters AST Al - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [84, 85], - loc: { 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 index aa816a04198..9d7963dae87 100644 --- 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 @@ -16,9 +16,12 @@ Program { TSAbstractMethodDefinition { type: "TSAbstractMethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "constructor", + optional: false, range: [123, 134], loc: { @@ -27,12 +30,14 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: TSEmptyBodyFunctionExpression { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -59,9 +64,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "AbstractSocket", + optional: false, range: [95, 109], loc: { @@ -69,6 +78,7 @@ Program { end: { column: 36, line: 3 }, }, }, + implements: Array [], superClass: null, range: [80, 139], 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 index d6d511ccbfd..fda50436316 100644 --- 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 @@ -23,9 +23,12 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-constr + type: 'MethodDefinition', + abstract: true, computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [123, 134], loc: { @@ -34,6 +37,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-constr }, }, kind: 'constructor', +- optional: false, - override: false, static: false, - value: TSEmptyBodyFunctionExpression { @@ -42,6 +46,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-constr + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -68,9 +73,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-constr end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'AbstractSocket', +- optional: false, range: [95, 109], loc: { @@ -78,6 +87,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-constr end: { column: 36, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [80, 139], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/1-TSESTree-AST.shot index 288e7b2ed70..981bc7f4732 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,12 @@ Program { TSAbstractMethodDefinition { type: "TSAbstractMethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "createSocket", + optional: false, range: [123, 135], loc: { @@ -27,12 +30,14 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: TSEmptyBodyFunctionExpression { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -63,7 +68,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Promise", + optional: false, range: [139, 146], loc: { @@ -127,9 +134,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "AbstractSocket", + optional: false, range: [95, 109], loc: { @@ -137,6 +148,7 @@ Program { end: { column: 36, line: 3 }, }, }, + implements: Array [], superClass: null, range: [80, 157], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/5-AST-Alignment-AST.shot index a39d1d8f6e2..10846964c2c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-method/snapshots/5-AST-Alignment-AST.shot @@ -23,9 +23,12 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-method + type: 'MethodDefinition', + abstract: true, computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'createSocket', +- optional: false, range: [123, 135], loc: { @@ -34,6 +37,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-method }, }, kind: 'method', +- optional: false, - override: false, static: false, - value: TSEmptyBodyFunctionExpression { @@ -42,6 +46,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-method + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -72,7 +77,9 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-method - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Promise', +- optional: false, range: [139, 146], loc: { @@ -136,9 +143,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-method end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'AbstractSocket', +- optional: false, range: [95, 109], loc: { @@ -146,6 +157,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-method end: { column: 36, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [80, 157], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-properties/snapshots/1-TSESTree-AST.shot index e45b5521871..b1fcc26a18b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-properties/snapshots/1-TSESTree-AST.shot @@ -14,9 +14,13 @@ Program { type: "TSAbstractPropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [105, 108], loc: { @@ -24,7 +28,9 @@ Program { end: { column: 14, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: null, @@ -38,9 +44,13 @@ Program { type: "TSAbstractPropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "baz", + optional: false, range: [121, 124], loc: { @@ -48,7 +58,9 @@ Program { end: { column: 14, line: 5 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -84,9 +96,13 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [88, 91], loc: { @@ -94,6 +110,7 @@ Program { end: { column: 18, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 135], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-properties/snapshots/5-AST-Alignment-AST.shot index 4989b7b35d1..4948c148db4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-properties/snapshots/5-AST-Alignment-AST.shot @@ -21,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-proper + abstract: true, computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [105, 108], loc: { @@ -31,7 +35,9 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-proper end: { column: 14, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: null, @@ -48,9 +54,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-proper + abstract: true, computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [121, 124], loc: { @@ -58,7 +68,9 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-proper end: { column: 14, line: 5 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -94,9 +106,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-proper end: { column: 1, line: 6 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [88, 91], loc: { @@ -104,6 +120,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-proper end: { column: 18, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 135], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-readonly-property/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-readonly-property/snapshots/1-TSESTree-AST.shot index 7009559f195..d7687e49e62 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-readonly-property/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-readonly-property/snapshots/1-TSESTree-AST.shot @@ -15,9 +15,13 @@ Program { accessibility: "public", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [121, 124], loc: { @@ -25,6 +29,7 @@ Program { end: { column: 30, line: 4 }, }, }, + optional: false, override: false, readonly: true, static: false, @@ -62,9 +67,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [88, 91], loc: { @@ -72,6 +81,7 @@ Program { end: { column: 18, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 135], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-readonly-property/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-readonly-property/snapshots/5-AST-Alignment-AST.shot index c7d5ecccd10..ee46582f5bd 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-readonly-property/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-abstract-readonly-property/snapshots/5-AST-Alignment-AST.shot @@ -22,9 +22,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-readon accessibility: 'public', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [121, 124], loc: { @@ -32,6 +36,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-readon end: { column: 30, line: 4 }, }, }, +- optional: false, - override: false, readonly: true, static: false, @@ -69,9 +74,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-readon end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [88, 91], loc: { @@ -79,6 +88,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-abstract-readon end: { column: 18, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 135], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-declare-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-declare-properties/snapshots/1-TSESTree-AST.shot index 63f3f0b3c81..0e2885cc5a4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-declare-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-declare-properties/snapshots/1-TSESTree-AST.shot @@ -14,9 +14,13 @@ Program { type: "PropertyDefinition", computed: false, declare: true, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop1", + optional: false, range: [118, 123], loc: { @@ -24,7 +28,9 @@ Program { end: { column: 15, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -56,9 +62,13 @@ Program { type: "TSAbstractPropertyDefinition", computed: false, declare: true, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop2", + optional: false, range: [152, 157], loc: { @@ -66,7 +76,9 @@ Program { end: { column: 24, line: 5 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -99,9 +111,13 @@ Program { accessibility: "public", computed: false, declare: true, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop3", + optional: false, range: [193, 198], loc: { @@ -109,7 +125,9 @@ Program { end: { column: 31, line: 6 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -141,9 +159,13 @@ Program { type: "TSAbstractPropertyDefinition", computed: false, declare: true, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop4", + optional: false, range: [236, 241], loc: { @@ -151,6 +173,7 @@ Program { end: { column: 33, line: 7 }, }, }, + optional: false, override: false, readonly: true, static: false, @@ -185,9 +208,13 @@ Program { accessibility: "public", computed: false, declare: true, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop5", + optional: false, range: [286, 291], loc: { @@ -195,6 +222,7 @@ Program { end: { column: 40, line: 8 }, }, }, + optional: false, override: false, readonly: true, static: false, @@ -232,9 +260,13 @@ Program { end: { column: 1, line: 9 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "AbstractDeclProps", + optional: false, range: [88, 105], loc: { @@ -242,6 +274,7 @@ Program { end: { column: 32, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 302], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-declare-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-declare-properties/snapshots/5-AST-Alignment-AST.shot index e96ac30a3b5..74e0cfac27b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-declare-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-declare-properties/snapshots/5-AST-Alignment-AST.shot @@ -18,9 +18,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert type: 'PropertyDefinition', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop1', +- optional: false, range: [118, 123], loc: { @@ -28,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert end: { column: 15, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -63,9 +69,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert + abstract: true, computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop2', +- optional: false, range: [152, 157], loc: { @@ -73,7 +83,9 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert end: { column: 24, line: 5 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -109,9 +121,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert accessibility: 'public', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop3', +- optional: false, range: [193, 198], loc: { @@ -119,7 +135,9 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert end: { column: 31, line: 6 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -154,9 +172,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert + abstract: true, computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop4', +- optional: false, range: [236, 241], loc: { @@ -164,6 +186,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert end: { column: 33, line: 7 }, }, }, +- optional: false, - override: false, readonly: true, static: false, @@ -201,9 +224,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert accessibility: 'public', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop5', +- optional: false, range: [286, 291], loc: { @@ -211,6 +238,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert end: { column: 40, line: 8 }, }, }, +- optional: false, - override: false, readonly: true, static: false, @@ -248,9 +276,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert end: { column: 1, line: 9 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'AbstractDeclProps', +- optional: false, range: [88, 105], loc: { @@ -258,6 +290,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-declare-propert end: { column: 32, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 302], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/1-TSESTree-AST.shot index 2fc857bfdba..828a42972e2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,12 @@ Program { MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "createSocket", + optional: false, range: [114, 126], loc: { @@ -34,6 +37,7 @@ Program { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -64,7 +68,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Promise", + optional: false, range: [131, 138], loc: { @@ -128,9 +134,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "AbstractSocket", + optional: false, range: [95, 109], loc: { @@ -138,6 +148,7 @@ Program { end: { column: 36, line: 3 }, }, }, + implements: Array [], superClass: null, range: [80, 149], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/5-AST-Alignment-AST.shot index 4db0ba1cb67..d19a4504b28 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/snapshots/5-AST-Alignment-AST.shot @@ -20,9 +20,12 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-optional-method MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'createSocket', +- optional: false, range: [114, 126], loc: { @@ -40,6 +43,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-optional-method + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -70,7 +74,9 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-optional-method - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Promise', +- optional: false, range: [131, 138], loc: { @@ -134,9 +140,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-optional-method end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'AbstractSocket', +- optional: false, range: [95, 109], loc: { @@ -144,6 +154,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-optional-method end: { column: 36, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [80, 149], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-override-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-override-method/snapshots/1-TSESTree-AST.shot index 47c5bb400fb..5bcaffd0d1d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-override-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-override-method/snapshots/1-TSESTree-AST.shot @@ -13,9 +13,12 @@ Program { TSAbstractMethodDefinition { type: "TSAbstractMethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "show", + optional: false, range: [153, 157], loc: { @@ -24,12 +27,14 @@ Program { }, }, kind: "method", + optional: false, override: true, static: false, value: TSEmptyBodyFunctionExpression { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -56,9 +61,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "SpecializedComponent", + optional: false, range: [88, 108], loc: { @@ -66,9 +75,12 @@ Program { end: { column: 35, line: 3 }, }, }, + implements: Array [], superClass: Identifier { type: "Identifier", + decorators: Array [], name: "SomeComponent", + optional: false, range: [117, 130], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-override-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-override-method/snapshots/5-AST-Alignment-AST.shot index a2123358d04..ef2f2ca4f2c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-override-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/abstract-class-with-override-method/snapshots/5-AST-Alignment-AST.shot @@ -20,9 +20,12 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-override-method + type: 'MethodDefinition', + abstract: true, computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'show', +- optional: false, range: [153, 157], loc: { @@ -31,6 +34,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-override-method }, }, kind: 'method', +- optional: false, override: true, static: false, - value: TSEmptyBodyFunctionExpression { @@ -39,6 +43,7 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-override-method + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -65,9 +70,13 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-override-method end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'SpecializedComponent', +- optional: false, range: [88, 108], loc: { @@ -75,9 +84,12 @@ exports[`AST Fixtures legacy-fixtures basics abstract-class-with-override-method end: { column: 35, line: 3 }, }, }, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'SomeComponent', +- optional: false, range: [117, 130], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion-arrow-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion-arrow-function/snapshots/1-TSESTree-AST.shot index 9eecb615e5e..48b928dbe67 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion-arrow-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion-arrow-function/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "asserted2", + optional: false, range: [77, 86], loc: { @@ -31,7 +34,9 @@ Program { type: "ReturnStatement", argument: Identifier { type: "Identifier", + decorators: Array [], name: "n", + optional: false, range: [111, 112], loc: { @@ -60,7 +65,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "n", + optional: false, range: [95, 96], loc: { @@ -100,6 +107,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [73, 117], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion-arrow-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion-arrow-function/snapshots/5-AST-Alignment-AST.shot index 59f0d0c3ecd..54b416cc358 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion-arrow-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion-arrow-function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,131 @@ exports[`AST Fixtures legacy-fixtures basics angle-bracket-type-assertion-arrow-function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'asserted2', +- optional: false, + + range: [77, 86], + loc: { + start: { column: 4, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + init: TSTypeAssertion { + type: 'TSTypeAssertion', + expression: ArrowFunctionExpression { + type: 'ArrowFunctionExpression', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ReturnStatement { + type: 'ReturnStatement', + argument: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'n', +- optional: false, + + range: [111, 112], + loc: { + start: { column: 9, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [104, 113], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + ], + + range: [100, 115], + loc: { + start: { column: 27, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + expression: false, + generator: false, + id: null, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'n', +- optional: false, + + range: [95, 96], + loc: { + start: { column: 22, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + ], + + range: [95, 115], + loc: { + start: { column: 22, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [90, 93], + loc: { + start: { column: 17, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [89, 116], + loc: { + start: { column: 16, line: 3 }, + end: { column: 2, line: 5 }, + }, + }, + + range: [77, 116], + loc: { + start: { column: 4, line: 3 }, + end: { column: 2, line: 5 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [73, 117], + loc: { + start: { column: 0, line: 3 }, + end: { column: 3, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 118], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion/snapshots/1-TSESTree-AST.shot index 3167e4026e4..e693b37b27f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [79, 82], loc: { @@ -56,6 +59,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [73, 92], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion/snapshots/5-AST-Alignment-AST.shot index bebd2e1766f..84875d060dd 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/angle-bracket-type-assertion/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,83 @@ exports[`AST Fixtures legacy-fixtures basics angle-bracket-type-assertion AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [79, 82], + loc: { + start: { column: 6, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + init: TSTypeAssertion { + type: 'TSTypeAssertion', + expression: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [90, 91], + loc: { + start: { column: 17, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [86, 89], + loc: { + start: { column: 13, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + + range: [85, 91], + loc: { + start: { column: 12, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [79, 91], + loc: { + start: { column: 6, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 93], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-optional-parameter/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-optional-parameter/snapshots/1-TSESTree-AST.shot index 0b5151cde87..91187cbf8b0 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-optional-parameter/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-optional-parameter/snapshots/1-TSESTree-AST.shot @@ -16,7 +16,9 @@ Program { type: "BinaryExpression", left: Identifier { type: "Identifier", + decorators: Array [], name: "k", + optional: false, range: [82, 83], loc: { @@ -49,6 +51,7 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "k", optional: true, diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-optional-parameter/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-optional-parameter/snapshots/5-AST-Alignment-AST.shot index ca850e74214..bbd26b80e71 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-optional-parameter/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-optional-parameter/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,99 @@ exports[`AST Fixtures legacy-fixtures basics arrow-function-with-optional-parameter AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: ArrowFunctionExpression { + type: 'ArrowFunctionExpression', + async: false, + body: BinaryExpression { + type: 'BinaryExpression', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'k', +- optional: false, + + range: [82, 83], + loc: { + start: { column: 9, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + operator: '+', + right: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [86, 87], + loc: { + start: { column: 13, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [82, 87], + loc: { + start: { column: 9, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + expression: true, + generator: false, + id: null, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'k', + optional: true, + + range: [75, 77], + loc: { + start: { column: 2, line: 3 }, + end: { column: 4, line: 3 }, + }, + }, + ], + + range: [74, 87], + loc: { + start: { column: 1, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + optional: false, + + range: [73, 90], + loc: { + start: { column: 0, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-type-parameters/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-type-parameters/snapshots/1-TSESTree-AST.shot index 788e721214b..67a5dda4323 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-type-parameters/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-type-parameters/snapshots/1-TSESTree-AST.shot @@ -16,7 +16,9 @@ Program { type: "ReturnStatement", argument: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [100, 101], loc: { @@ -45,14 +47,18 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "X", + optional: false, range: [80, 81], loc: { @@ -88,7 +94,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "X", + optional: false, range: [84, 85], loc: { @@ -118,7 +126,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "X", + optional: false, range: [74, 75], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-type-parameters/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-type-parameters/snapshots/5-AST-Alignment-AST.shot index 0886302ddde..902aae8972c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-type-parameters/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/arrow-function-with-type-parameters/snapshots/5-AST-Alignment-AST.shot @@ -20,7 +20,9 @@ exports[`AST Fixtures legacy-fixtures basics arrow-function-with-type-parameters type: 'ReturnStatement', argument: Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [100, 101], loc: { @@ -49,14 +51,18 @@ exports[`AST Fixtures legacy-fixtures basics arrow-function-with-type-parameters params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [80, 81], loc: { @@ -92,7 +98,9 @@ exports[`AST Fixtures legacy-fixtures basics arrow-function-with-type-parameters type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [84, 85], loc: { @@ -122,7 +130,9 @@ exports[`AST Fixtures legacy-fixtures basics arrow-function-with-type-parameters - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'X', +- optional: false, - - range: [74, 75], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-expression/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-expression/snapshots/1-TSESTree-AST.shot index 07c9fd1f6ca..4168b61ff95 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-expression/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-expression/snapshots/1-TSESTree-AST.shot @@ -22,11 +22,14 @@ Program { end: { column: 25, line: 3 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "test", + optional: false, range: [89, 93], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-expression/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-expression/snapshots/5-AST-Alignment-AST.shot index 6db212a6049..cf09dbcceea 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-expression/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-expression/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,75 @@ exports[`AST Fixtures legacy-fixtures basics async-function-expression AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: FunctionExpression { + type: 'FunctionExpression', + async: true, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [96, 98], + loc: { + start: { column: 23, line: 3 }, + end: { column: 25, line: 3 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'test', +- optional: false, + + range: [89, 93], + loc: { + start: { column: 16, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + params: Array [], + + range: [74, 98], + loc: { + start: { column: 1, line: 3 }, + end: { column: 25, line: 3 }, + }, + }, + optional: false, + + range: [73, 101], + loc: { + start: { column: 0, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + + range: [73, 102], + loc: { + start: { column: 0, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 103], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-with-var-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-with-var-declaration/snapshots/1-TSESTree-AST.shot index 57dd682e58b..c7a45a38c0c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-with-var-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-with-var-declaration/snapshots/1-TSESTree-AST.shot @@ -15,9 +15,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [103, 106], loc: { @@ -44,6 +47,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [99, 115], @@ -57,9 +61,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [122, 125], loc: { @@ -86,6 +93,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [118, 134], @@ -99,9 +107,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "fooBar", + optional: false, range: [143, 149], loc: { @@ -128,6 +139,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [137, 161], @@ -144,11 +156,14 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "test", + optional: false, range: [88, 92], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-with-var-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-with-var-declaration/snapshots/5-AST-Alignment-AST.shot index f37f21626eb..1dc4f648b48 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-with-var-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/async-function-with-var-declaration/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,194 @@ exports[`AST Fixtures legacy-fixtures basics async-function-with-var-declaration AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: true, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [103, 106], + loc: { + start: { column: 6, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '\\\\'foo\\\\'', + value: 'foo', + + range: [109, 114], + loc: { + start: { column: 12, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + + range: [103, 114], + loc: { + start: { column: 6, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [99, 115], + loc: { + start: { column: 2, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [122, 125], + loc: { + start: { column: 6, line: 5 }, + end: { column: 9, line: 5 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '\\\\'bar\\\\'', + value: 'bar', + + range: [128, 133], + loc: { + start: { column: 12, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + + range: [122, 133], + loc: { + start: { column: 6, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [118, 134], + loc: { + start: { column: 2, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fooBar', +- optional: false, + + range: [143, 149], + loc: { + start: { column: 8, line: 6 }, + end: { column: 14, line: 6 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '\\\\'fooBar\\\\'', + value: 'fooBar', + + range: [152, 160], + loc: { + start: { column: 17, line: 6 }, + end: { column: 25, line: 6 }, + }, + }, + + range: [143, 160], + loc: { + start: { column: 8, line: 6 }, + end: { column: 25, line: 6 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [137, 161], + loc: { + start: { column: 2, line: 6 }, + end: { column: 26, line: 6 }, + }, + }, + ], + + range: [95, 163], + loc: { + start: { column: 22, line: 3 }, + end: { column: 1, line: 7 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'test', +- optional: false, + + range: [88, 92], + loc: { + start: { column: 15, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + params: Array [], + + range: [73, 163], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 7 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 164], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 8 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures-with-generics/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures-with-generics/snapshots/1-TSESTree-AST.shot index 9346217d8e1..16df417045e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures-with-generics/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures-with-generics/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [78, 81], loc: { @@ -24,7 +27,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -77,7 +82,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [89, 90], loc: { @@ -113,7 +120,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -166,7 +175,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [119, 120], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures-with-generics/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures-with-generics/snapshots/5-AST-Alignment-AST.shot index 6a4db1dffed..851c59576e2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures-with-generics/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures-with-generics/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures basics call-signatures-with-generics AST A body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [78, 81], loc: { @@ -29,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics call-signatures-with-generics AST A + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -83,7 +88,9 @@ exports[`AST Fixtures legacy-fixtures basics call-signatures-with-generics AST A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [89, 90], - loc: { @@ -121,7 +128,9 @@ exports[`AST Fixtures legacy-fixtures basics call-signatures-with-generics AST A + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -175,7 +184,9 @@ exports[`AST Fixtures legacy-fixtures basics call-signatures-with-generics AST A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [119, 120], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures/snapshots/1-TSESTree-AST.shot index 1ebb9dfa9a9..db49d473eca 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [78, 81], loc: { @@ -24,7 +27,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -81,7 +86,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures/snapshots/5-AST-Alignment-AST.shot index 33b93128e07..2710a0bc202 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/call-signatures/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures basics call-signatures AST Alignment - AST body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [78, 81], loc: { @@ -29,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics call-signatures AST Alignment - AST + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -88,7 +93,9 @@ exports[`AST Fixtures legacy-fixtures basics call-signatures AST Alignment - AST + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-expression/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-expression/snapshots/1-TSESTree-AST.shot index 14cfecc4748..1c5e5645fe8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-expression/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-expression/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { type: "BinaryExpression", left: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [74, 75], loc: { @@ -23,7 +25,9 @@ Program { operator: "<", right: Identifier { type: "Identifier", + decorators: Array [], name: "y", + optional: false, range: [78, 79], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-expression/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-expression/snapshots/5-AST-Alignment-AST.shot index 5a48762a733..dcef318b25b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-expression/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-expression/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,80 @@ exports[`AST Fixtures legacy-fixtures basics cast-as-expression AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSAsExpression { + type: 'TSAsExpression', + expression: BinaryExpression { + type: 'BinaryExpression', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [74, 75], + loc: { + start: { column: 1, line: 3 }, + end: { column: 2, line: 3 }, + }, + }, + operator: '<', + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'y', +- optional: false, + + range: [78, 79], + loc: { + start: { column: 5, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + + range: [74, 79], + loc: { + start: { column: 1, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + typeAnnotation: TSBooleanKeyword { + type: 'TSBooleanKeyword', + + range: [84, 91], + loc: { + start: { column: 11, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 93], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi-assign/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi-assign/snapshots/1-TSESTree-AST.shot index 2eda95a6440..b1baeb119c7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi-assign/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi-assign/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { type: "TSAsExpression", expression: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [74, 75], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi-assign/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi-assign/snapshots/5-AST-Alignment-AST.shot index a4c620a74b8..70b1609db0f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi-assign/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi-assign/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,97 @@ exports[`AST Fixtures legacy-fixtures basics cast-as-multi-assign AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: AssignmentExpression { + type: 'AssignmentExpression', + left: TSAsExpression { + type: 'TSAsExpression', + expression: TSAsExpression { + type: 'TSAsExpression', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [74, 75], + loc: { + start: { column: 1, line: 3 }, + end: { column: 2, line: 3 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [79, 85], + loc: { + start: { column: 6, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + + range: [74, 85], + loc: { + start: { column: 1, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [89, 92], + loc: { + start: { column: 16, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [74, 92], + loc: { + start: { column: 1, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + operator: '=', + right: Literal { + type: 'Literal', + raw: '42', + value: 42, + + range: [96, 98], + loc: { + start: { column: 23, line: 3 }, + end: { column: 25, line: 3 }, + }, + }, + + range: [73, 98], + loc: { + start: { column: 0, line: 3 }, + end: { column: 25, line: 3 }, + }, + }, + + range: [73, 99], + loc: { + start: { column: 0, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 100], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi/snapshots/1-TSESTree-AST.shot index 5f7a2d81d46..b06bbdd9a1e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { type: "TSAsExpression", expression: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [73, 74], loc: { @@ -40,7 +42,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [85, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi/snapshots/5-AST-Alignment-AST.shot index 38599adfe7f..7705dd06189 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-multi/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,88 @@ exports[`AST Fixtures legacy-fixtures basics cast-as-multi AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: TSAsExpression { + type: 'TSAsExpression', + expression: TSAsExpression { + type: 'TSAsExpression', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [73, 74], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [73, 81], + loc: { + start: { column: 0, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'T', +- optional: false, + + range: [85, 86], + loc: { + start: { column: 12, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [85, 86], + loc: { + start: { column: 12, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [73, 86], + loc: { + start: { column: 0, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [73, 87], + loc: { + start: { column: 0, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 88], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-operator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-operator/snapshots/1-TSESTree-AST.shot index 68298b56277..f1877e3bf35 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-operator/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-operator/snapshots/1-TSESTree-AST.shot @@ -10,7 +10,9 @@ Program { type: "BinaryExpression", left: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [73, 74], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-operator/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-operator/snapshots/5-AST-Alignment-AST.shot index 4b0c8c0b06b..d8af856f0d4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-operator/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-operator/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,79 @@ exports[`AST Fixtures legacy-fixtures basics cast-as-operator AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: BinaryExpression { + type: 'BinaryExpression', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [73, 74], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, + operator: '===', + right: TSAsExpression { + type: 'TSAsExpression', + expression: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [80, 81], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [85, 91], + loc: { + start: { column: 12, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [80, 91], + loc: { + start: { column: 7, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [73, 93], + loc: { + start: { column: 0, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-simple/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-simple/snapshots/1-TSESTree-AST.shot index fc82bb51bf3..1519db7ed6b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-simple/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-simple/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [79, 82], loc: { @@ -23,7 +26,9 @@ Program { type: "TSAsExpression", expression: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [85, 86], loc: { @@ -55,6 +60,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [73, 94], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-simple/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-simple/snapshots/5-AST-Alignment-AST.shot index 2f9dfe1a235..a61cfb5f5e7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-simple/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/cast-as-simple/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,84 @@ exports[`AST Fixtures legacy-fixtures basics cast-as-simple AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [79, 82], + loc: { + start: { column: 6, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + init: TSAsExpression { + type: 'TSAsExpression', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [85, 86], + loc: { + start: { column: 12, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [90, 93], + loc: { + start: { column: 17, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [85, 93], + loc: { + start: { column: 12, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [79, 93], + loc: { + start: { column: 6, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 95], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-annotation/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-annotation/snapshots/1-TSESTree-AST.shot index 73031bf931e..78fbb6bd077 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-annotation/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-annotation/snapshots/1-TSESTree-AST.shot @@ -31,7 +31,9 @@ Program { }, param: Identifier { type: "Identifier", + decorators: Array [], name: "e", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { @@ -98,7 +100,9 @@ Program { }, param: Identifier { type: "Identifier", + decorators: Array [], name: "e", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnknownKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-annotation/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-annotation/snapshots/5-AST-Alignment-AST.shot index 89b8eb95c59..9436e8fa208 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-annotation/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-annotation/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,157 @@ exports[`AST Fixtures legacy-fixtures basics catch-clause-with-annotation AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TryStatement { + type: 'TryStatement', + block: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [77, 80], + loc: { + start: { column: 4, line: 3 }, + end: { column: 1, line: 4 }, + }, + }, + finalizer: null, + handler: CatchClause { + type: 'CatchClause', + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [96, 98], + loc: { + start: { column: 17, line: 4 }, + end: { column: 19, line: 4 }, + }, + }, + param: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'e', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [91, 94], + loc: { + start: { column: 12, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + + range: [89, 94], + loc: { + start: { column: 10, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + + range: [88, 94], + loc: { + start: { column: 9, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + + range: [81, 98], + loc: { + start: { column: 2, line: 4 }, + end: { column: 19, line: 4 }, + }, + }, + + range: [73, 98], + loc: { + start: { column: 0, line: 3 }, + end: { column: 19, line: 4 }, + }, + }, + TryStatement { + type: 'TryStatement', + block: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [104, 107], + loc: { + start: { column: 4, line: 6 }, + end: { column: 1, line: 7 }, + }, + }, + finalizer: null, + handler: CatchClause { + type: 'CatchClause', + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [127, 129], + loc: { + start: { column: 21, line: 7 }, + end: { column: 23, line: 7 }, + }, + }, + param: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'e', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSUnknownKeyword { + type: 'TSUnknownKeyword', + + range: [118, 125], + loc: { + start: { column: 12, line: 7 }, + end: { column: 19, line: 7 }, + }, + }, + + range: [116, 125], + loc: { + start: { column: 10, line: 7 }, + end: { column: 19, line: 7 }, + }, + }, + + range: [115, 125], + loc: { + start: { column: 9, line: 7 }, + end: { column: 19, line: 7 }, + }, + }, + + range: [108, 129], + loc: { + start: { column: 2, line: 7 }, + end: { column: 23, line: 7 }, + }, + }, + + range: [100, 129], + loc: { + start: { column: 0, line: 6 }, + end: { column: 23, line: 7 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 130], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 8 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-invalid-annotation/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-invalid-annotation/snapshots/1-TSESTree-AST.shot index cf0a97d3afd..1477988ab6e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-invalid-annotation/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-invalid-annotation/snapshots/1-TSESTree-AST.shot @@ -31,7 +31,9 @@ Program { }, param: Identifier { type: "Identifier", + decorators: Array [], name: "e", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-invalid-annotation/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-invalid-annotation/snapshots/5-AST-Alignment-AST.shot index ff4be300dbe..6aef5769b95 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-invalid-annotation/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/catch-clause-with-invalid-annotation/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,88 @@ exports[`AST Fixtures legacy-fixtures basics catch-clause-with-invalid-annotation AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TryStatement { + type: 'TryStatement', + block: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [77, 80], + loc: { + start: { column: 4, line: 3 }, + end: { column: 1, line: 4 }, + }, + }, + finalizer: null, + handler: CatchClause { + type: 'CatchClause', + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [99, 101], + loc: { + start: { column: 20, line: 4 }, + end: { column: 22, line: 4 }, + }, + }, + param: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'e', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [91, 97], + loc: { + start: { column: 12, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + + range: [89, 97], + loc: { + start: { column: 10, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + + range: [88, 97], + loc: { + start: { column: 9, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + + range: [81, 101], + loc: { + start: { column: 2, line: 4 }, + end: { column: 22, line: 4 }, + }, + }, + + range: [73, 101], + loc: { + start: { column: 0, line: 3 }, + end: { column: 22, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 102], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-abstract/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-abstract/snapshots/1-TSESTree-AST.shot index 3b834e81c9b..0c081b812d2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-abstract/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-abstract/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "ExpressionStatement", expression: Identifier { type: "Identifier", + decorators: Array [], name: "abstract", + optional: false, range: [73, 81], loc: { @@ -25,6 +27,7 @@ Program { }, ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -35,9 +38,13 @@ Program { end: { column: 10, line: 4 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [89, 90], loc: { @@ -45,6 +52,7 @@ Program { end: { column: 7, line: 4 }, }, }, + implements: Array [], superClass: null, range: [83, 93], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-abstract/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-abstract/snapshots/5-AST-Alignment-AST.shot index c36526457e7..107bcb11f9a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-abstract/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-abstract/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,76 @@ exports[`AST Fixtures legacy-fixtures basics class-multi-line-keyword-abstract AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'abstract', +- optional: false, + + range: [73, 81], + loc: { + start: { column: 0, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [73, 82], + loc: { + start: { column: 0, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [91, 93], + loc: { + start: { column: 8, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'B', +- optional: false, + + range: [89, 90], + loc: { + start: { column: 6, line: 4 }, + end: { column: 7, line: 4 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [83, 93], + loc: { + start: { column: 0, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-declare/snapshots/1-TSESTree-AST.shot index d834afb0bae..e64e6e4f932 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-declare/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-declare/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "ExpressionStatement", expression: Identifier { type: "Identifier", + decorators: Array [], name: "declare", + optional: false, range: [73, 80], loc: { @@ -25,6 +27,7 @@ Program { }, ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -35,9 +38,13 @@ Program { end: { column: 10, line: 4 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [88, 89], loc: { @@ -45,6 +52,7 @@ Program { end: { column: 7, line: 4 }, }, }, + implements: Array [], superClass: null, range: [82, 92], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-declare/snapshots/5-AST-Alignment-AST.shot index 91ba03ff880..7b635aa1f26 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-declare/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-multi-line-keyword-declare/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,76 @@ exports[`AST Fixtures legacy-fixtures basics class-multi-line-keyword-declare AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'declare', +- optional: false, + + range: [73, 80], + loc: { + start: { column: 0, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + + range: [73, 81], + loc: { + start: { column: 0, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [90, 92], + loc: { + start: { column: 8, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'B', +- optional: false, + + range: [88, 89], + loc: { + start: { column: 6, line: 4 }, + end: { column: 7, line: 4 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [82, 92], + loc: { + start: { column: 0, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 93], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-field-with-annotation/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-field-with-annotation/snapshots/1-TSESTree-AST.shot index 798be99f4e4..baca13a0823 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-field-with-annotation/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-field-with-annotation/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,6 +14,8 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: PrivateIdentifier { type: "PrivateIdentifier", name: "priv1", @@ -23,7 +26,9 @@ Program { end: { column: 8, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -55,6 +60,8 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: PrivateIdentifier { type: "PrivateIdentifier", name: "priv2", @@ -65,7 +72,9 @@ Program { end: { column: 8, line: 5 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -106,9 +115,12 @@ Program { MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "constructor", + optional: false, range: [128, 139], loc: { @@ -117,6 +129,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -193,6 +206,7 @@ Program { end: { column: 3, line: 9 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -219,9 +233,13 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -229,6 +247,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 170], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-field-with-annotation/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-field-with-annotation/snapshots/5-AST-Alignment-AST.shot index 50e07fdec6a..8db2a072d5d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-field-with-annotation/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-field-with-annotation/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-field-with body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,6 +18,8 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-field-with type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: PrivateIdentifier { type: 'PrivateIdentifier', name: 'priv1', @@ -27,7 +30,9 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-field-with end: { column: 8, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -59,6 +64,8 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-field-with type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: PrivateIdentifier { type: 'PrivateIdentifier', name: 'priv2', @@ -69,7 +76,9 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-field-with end: { column: 8, line: 5 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -110,9 +119,12 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-field-with MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [128, 139], loc: { @@ -121,6 +133,7 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-field-with }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -197,6 +210,7 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-field-with end: { column: 3, line: 9 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -223,9 +237,13 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-field-with end: { column: 1, line: 10 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -233,6 +251,7 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-field-with end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 170], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-readonly-field/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-readonly-field/snapshots/1-TSESTree-AST.shot index eebfd0349f2..bd686f3897f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-readonly-field/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-readonly-field/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,6 +14,8 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: PrivateIdentifier { type: "PrivateIdentifier", name: "priv", @@ -23,6 +26,7 @@ Program { end: { column: 16, line: 4 }, }, }, + optional: false, override: false, readonly: true, static: false, @@ -60,9 +64,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -70,6 +78,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 112], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-readonly-field/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-readonly-field/snapshots/5-AST-Alignment-AST.shot index 4a94acfc12a..9a97960820e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-readonly-field/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-private-identifier-readonly-field/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-readonly-f body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,6 +18,8 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-readonly-f type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: PrivateIdentifier { type: 'PrivateIdentifier', name: 'priv', @@ -27,6 +30,7 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-readonly-f end: { column: 16, line: 4 }, }, }, +- optional: false, - override: false, readonly: true, static: false, @@ -64,9 +68,13 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-readonly-f end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -74,6 +82,7 @@ exports[`AST Fixtures legacy-fixtures basics class-private-identifier-readonly-f end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 112], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-static-blocks/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-static-blocks/snapshots/1-TSESTree-AST.shot index 6050bf68a3b..91d73e44a5c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-static-blocks/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-static-blocks/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,9 +14,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "count", + optional: false, range: [94, 99], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 14, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: true, value: Literal { type: "Literal", @@ -58,7 +65,9 @@ Program { type: "UpdateExpression", argument: Identifier { type: "Identifier", + decorators: Array [], name: "count", + optional: false, range: [149, 154], loc: { @@ -95,7 +104,9 @@ Program { arguments: Array [], callee: Identifier { type: "Identifier", + decorators: Array [], name: "someCondition", + optional: false, range: [124, 137], loc: { @@ -134,9 +145,13 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -144,6 +159,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 169], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-static-blocks/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-static-blocks/snapshots/5-AST-Alignment-AST.shot index c937657039c..ed9cb590a61 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-static-blocks/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-static-blocks/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-static-blocks AST Alignment - body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,9 +18,13 @@ exports[`AST Fixtures legacy-fixtures basics class-static-blocks AST Alignment - type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'count', +- optional: false, range: [94, 99], loc: { @@ -27,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics class-static-blocks AST Alignment - end: { column: 14, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: true, value: Literal { type: 'Literal', @@ -62,7 +69,9 @@ exports[`AST Fixtures legacy-fixtures basics class-static-blocks AST Alignment - type: 'UpdateExpression', argument: Identifier { type: 'Identifier', +- decorators: Array [], name: 'count', +- optional: false, range: [149, 154], loc: { @@ -99,7 +108,9 @@ exports[`AST Fixtures legacy-fixtures basics class-static-blocks AST Alignment - arguments: Array [], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'someCondition', +- optional: false, range: [124, 137], loc: { @@ -138,9 +149,13 @@ exports[`AST Fixtures legacy-fixtures basics class-static-blocks AST Alignment - end: { column: 1, line: 10 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -148,6 +163,7 @@ exports[`AST Fixtures legacy-fixtures basics class-static-blocks AST Alignment - end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 169], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-accessibility-modifiers/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-accessibility-modifiers/snapshots/1-TSESTree-AST.shot index fac5f0ca998..85509464b6e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-accessibility-modifiers/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-accessibility-modifiers/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -14,9 +15,13 @@ Program { accessibility: "private", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [95, 98], loc: { @@ -24,7 +29,9 @@ Program { end: { column: 13, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -57,9 +64,13 @@ Program { accessibility: "public", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "baz", + optional: false, range: [124, 127], loc: { @@ -67,7 +78,9 @@ Program { end: { column: 19, line: 5 }, }, }, + optional: false, override: false, + readonly: false, static: true, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -99,9 +112,12 @@ Program { type: "MethodDefinition", accessibility: "public", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "getBar", + optional: false, range: [146, 152], loc: { @@ -110,6 +126,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -135,7 +152,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [173, 176], loc: { @@ -165,6 +184,7 @@ Program { end: { column: 3, line: 8 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -187,9 +207,12 @@ Program { type: "MethodDefinition", accessibility: "protected", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "setBar", + optional: false, range: [194, 200], loc: { @@ -198,6 +221,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -225,7 +249,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [225, 228], loc: { @@ -243,7 +269,9 @@ Program { operator: "=", right: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [231, 234], loc: { @@ -273,13 +301,16 @@ Program { end: { column: 3, line: 11 }, }, }, + declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -328,9 +359,13 @@ Program { end: { column: 1, line: 12 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -338,6 +373,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 241], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-accessibility-modifiers/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-accessibility-modifiers/snapshots/5-AST-Alignment-AST.shot index 3e92199a42e..bb1a1c4bac1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-accessibility-modifiers/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-accessibility-modifiers/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -18,9 +19,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers accessibility: 'private', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [95, 98], loc: { @@ -28,7 +33,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers end: { column: 13, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -61,9 +68,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers accessibility: 'public', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [124, 127], loc: { @@ -71,7 +82,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers end: { column: 19, line: 5 }, }, }, +- optional: false, - override: false, +- readonly: false, static: true, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -103,9 +116,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers type: 'MethodDefinition', accessibility: 'public', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'getBar', +- optional: false, range: [146, 152], loc: { @@ -114,6 +130,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -139,7 +156,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [173, 176], loc: { @@ -169,6 +188,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers end: { column: 3, line: 8 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -191,9 +211,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers type: 'MethodDefinition', accessibility: 'protected', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'setBar', +- optional: false, range: [194, 200], loc: { @@ -202,6 +225,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -229,7 +253,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [225, 228], loc: { @@ -247,7 +273,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers operator: '=', right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [231, 234], loc: { @@ -277,13 +305,16 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers end: { column: 3, line: 11 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -332,9 +363,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers end: { column: 1, line: 12 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -342,6 +377,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-accessibility-modifiers end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 241], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-modifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-modifier/snapshots/1-TSESTree-AST.shot index e46d4782682..46f090d2c23 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-modifier/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-modifier/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,9 +14,12 @@ Program { type: "MethodDefinition", accessibility: "protected", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "constructor", + optional: false, range: [95, 106], loc: { @@ -24,6 +28,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -39,6 +44,7 @@ Program { end: { column: 28, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -61,6 +67,7 @@ Program { type: "MethodDefinition", accessibility: "public", computed: true, + decorators: Array [], key: Literal { type: "Literal", raw: "'constructor'", @@ -73,6 +80,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -88,6 +96,7 @@ Program { end: { column: 29, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -114,9 +123,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "C", + optional: false, range: [79, 80], loc: { @@ -124,6 +137,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 144], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-modifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-modifier/snapshots/5-AST-Alignment-AST.shot index 09565af5792..0c6cd11fa53 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-modifier/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-modifier/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-modifier body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,9 +18,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-modifier type: 'MethodDefinition', accessibility: 'protected', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [95, 106], loc: { @@ -28,6 +32,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-modifier }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -43,6 +48,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-modifier end: { column: 28, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -65,6 +71,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-modifier type: 'MethodDefinition', accessibility: 'public', computed: true, +- decorators: Array [], key: Literal { type: 'Literal', raw: '\\\\'constructor\\\\'', @@ -77,6 +84,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-modifier }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -92,6 +100,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-modifier end: { column: 29, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -118,9 +127,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-modifier end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [79, 80], loc: { @@ -128,6 +141,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-modifier end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 144], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-property-with-modifiers/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-property-with-modifiers/snapshots/1-TSESTree-AST.shot index a0d2cc8f025..f77116b8156 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-property-with-modifiers/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-property-with-modifiers/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "constructor", + optional: false, range: [126, 137], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 59, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -45,10 +51,13 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "protected", + decorators: Array [], override: true, parameter: Identifier { type: "Identifier", + decorators: Array [], name: "param", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -75,6 +84,7 @@ Program { }, }, readonly: true, + static: false, range: [138, 179], loc: { @@ -105,9 +115,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "SpecializedComponent", + optional: false, range: [79, 99], loc: { @@ -115,9 +129,12 @@ Program { end: { column: 26, line: 3 }, }, }, + implements: Array [], superClass: Identifier { type: "Identifier", + decorators: Array [], name: "SomeComponent", + optional: false, range: [108, 121], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-property-with-modifiers/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-property-with-modifiers/snapshots/5-AST-Alignment-AST.shot index 1fad65fb13d..e9cb84b1934 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-property-with-modifiers/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-property-with-modifiers/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [126, 137], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete end: { column: 59, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -49,10 +55,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete TSParameterProperty { type: 'TSParameterProperty', accessibility: 'protected', +- decorators: Array [], override: true, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'param', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -79,6 +88,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete }, }, readonly: true, +- static: false, range: [138, 179], loc: { @@ -109,9 +119,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'SpecializedComponent', +- optional: false, range: [79, 99], loc: { @@ -119,9 +133,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete end: { column: 26, line: 3 }, }, }, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'SomeComponent', +- optional: false, range: [108, 121], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-proptery-with-override-modifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-proptery-with-override-modifier/snapshots/1-TSESTree-AST.shot index c1328dc7116..b612d6ffba8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-proptery-with-override-modifier/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-proptery-with-override-modifier/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "constructor", + optional: false, range: [126, 137], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -68,16 +73,20 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, params: Array [ TSParameterProperty { type: "TSParameterProperty", + decorators: Array [], override: true, parameter: Identifier { type: "Identifier", + decorators: Array [], name: "param", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -103,6 +112,8 @@ Program { end: { column: 36, line: 4 }, }, }, + readonly: false, + static: false, range: [138, 160], loc: { @@ -133,9 +144,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "SpecializedComponent", + optional: false, range: [79, 99], loc: { @@ -143,9 +158,12 @@ Program { end: { column: 26, line: 3 }, }, }, + implements: Array [], superClass: Identifier { type: "Identifier", + decorators: Array [], name: "SomeComponent", + optional: false, range: [108, 121], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-proptery-with-override-modifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-proptery-with-override-modifier/snapshots/5-AST-Alignment-AST.shot index fa57caf9773..30ed3a5d2b9 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-proptery-with-override-modifier/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-parameter-proptery-with-override-modifier/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [126, 137], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -72,16 +77,20 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete end: { column: 3, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ TSParameterProperty { type: 'TSParameterProperty', +- decorators: Array [], override: true, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'param', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -107,6 +116,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete end: { column: 36, line: 4 }, }, }, +- readonly: false, +- static: false, range: [138, 160], loc: { @@ -137,9 +148,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'SpecializedComponent', +- optional: false, range: [79, 99], loc: { @@ -147,9 +162,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-paramete end: { column: 26, line: 3 }, }, }, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'SomeComponent', +- optional: false, range: [108, 121], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-return-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-return-type/snapshots/1-TSESTree-AST.shot index 8f34afd368c..bd299704dab 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-return-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-return-type/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "constructor", + optional: false, range: [85, 96], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 26, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -77,6 +83,7 @@ Program { MethodDefinition { type: "MethodDefinition", computed: true, + decorators: Array [], key: Literal { type: "Literal", raw: "'constructor'", @@ -89,6 +96,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -104,6 +112,7 @@ Program { end: { column: 30, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -148,9 +157,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "C", + optional: false, range: [79, 80], loc: { @@ -158,6 +171,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 143], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-return-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-return-type/snapshots/5-AST-Alignment-AST.shot index 6cb5474d664..aa38bc14454 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-return-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-constructor-and-return-type/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-return-t body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [85, 96], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-return-t }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-return-t end: { column: 26, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -81,6 +87,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-return-t MethodDefinition { type: 'MethodDefinition', computed: true, +- decorators: Array [], key: Literal { type: 'Literal', raw: '\\\\'constructor\\\\'', @@ -93,6 +100,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-return-t }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -108,6 +116,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-return-t end: { column: 30, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -152,9 +161,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-return-t end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [79, 80], loc: { @@ -162,6 +175,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-constructor-and-return-t end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 143], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-declare-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-declare-properties/snapshots/1-TSESTree-AST.shot index ec98ef7f34f..4b2f8c46a21 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-declare-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-declare-properties/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,9 +14,13 @@ Program { type: "PropertyDefinition", computed: false, declare: true, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop1", + optional: false, range: [101, 106], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 15, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -56,9 +63,13 @@ Program { accessibility: "public", computed: false, declare: true, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop2", + optional: false, range: [133, 138], loc: { @@ -66,7 +77,9 @@ Program { end: { column: 22, line: 5 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -98,9 +111,13 @@ Program { type: "PropertyDefinition", computed: false, declare: true, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop3", + optional: false, range: [165, 170], loc: { @@ -108,7 +125,9 @@ Program { end: { column: 22, line: 6 }, }, }, + optional: false, override: false, + readonly: false, static: true, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -140,9 +159,13 @@ Program { type: "PropertyDefinition", computed: false, declare: true, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop3", + optional: false, range: [199, 204], loc: { @@ -150,6 +173,7 @@ Program { end: { column: 24, line: 7 }, }, }, + optional: false, override: false, readonly: true, static: false, @@ -184,9 +208,13 @@ Program { accessibility: "public", computed: false, declare: true, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop4", + optional: false, range: [240, 245], loc: { @@ -194,6 +222,7 @@ Program { end: { column: 31, line: 8 }, }, }, + optional: false, override: false, readonly: true, static: false, @@ -228,9 +257,13 @@ Program { accessibility: "public", computed: false, declare: true, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop5", + optional: false, range: [279, 284], loc: { @@ -238,7 +271,9 @@ Program { end: { column: 29, line: 9 }, }, }, + optional: false, override: false, + readonly: false, static: true, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -271,9 +306,13 @@ Program { accessibility: "public", computed: false, declare: true, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop6", + optional: false, range: [327, 332], loc: { @@ -281,6 +320,7 @@ Program { end: { column: 38, line: 10 }, }, }, + optional: false, override: false, readonly: true, static: true, @@ -318,9 +358,13 @@ Program { end: { column: 1, line: 11 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "DeclProps", + optional: false, range: [79, 88], loc: { @@ -328,6 +372,7 @@ Program { end: { column: 15, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 343], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-declare-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-declare-properties/snapshots/5-AST-Alignment-AST.shot index 66ba0b55662..07399bd45ca 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-declare-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-declare-properties/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,9 +18,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A type: 'PropertyDefinition', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop1', +- optional: false, range: [101, 106], loc: { @@ -27,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A end: { column: 15, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -60,9 +67,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A accessibility: 'public', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop2', +- optional: false, range: [133, 138], loc: { @@ -70,7 +81,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A end: { column: 22, line: 5 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -102,9 +115,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A type: 'PropertyDefinition', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop3', +- optional: false, range: [165, 170], loc: { @@ -112,7 +129,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A end: { column: 22, line: 6 }, }, }, +- optional: false, - override: false, +- readonly: false, static: true, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -144,9 +163,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A type: 'PropertyDefinition', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop3', +- optional: false, range: [199, 204], loc: { @@ -154,6 +177,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A end: { column: 24, line: 7 }, }, }, +- optional: false, - override: false, readonly: true, static: false, @@ -188,9 +212,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A accessibility: 'public', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop4', +- optional: false, range: [240, 245], loc: { @@ -198,6 +226,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A end: { column: 31, line: 8 }, }, }, +- optional: false, - override: false, readonly: true, static: false, @@ -232,9 +261,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A accessibility: 'public', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop5', +- optional: false, range: [279, 284], loc: { @@ -242,7 +275,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A end: { column: 29, line: 9 }, }, }, +- optional: false, - override: false, +- readonly: false, static: true, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -275,9 +310,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A accessibility: 'public', computed: false, declare: true, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop6', +- optional: false, range: [327, 332], loc: { @@ -285,6 +324,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A end: { column: 38, line: 10 }, }, }, +- optional: false, - override: false, readonly: true, static: true, @@ -322,9 +362,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A end: { column: 1, line: 11 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'DeclProps', +- optional: false, range: [79, 88], loc: { @@ -332,6 +376,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-declare-properties AST A end: { column: 15, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 343], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-definite-assignment/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-definite-assignment/snapshots/1-TSESTree-AST.shot index cb2932887fd..539c81dd10c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-definite-assignment/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-definite-assignment/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,10 +14,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], definite: true, key: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [85, 86], loc: { @@ -24,7 +28,9 @@ Program { end: { column: 3, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -60,9 +66,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "X", + optional: false, range: [79, 80], loc: { @@ -70,6 +80,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 98], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-definite-assignment/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-definite-assignment/snapshots/5-AST-Alignment-AST.shot index 12dd36c717a..21ac2c6a3ca 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-definite-assignment/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-definite-assignment/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-definite-assignment AST body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,10 +18,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-definite-assignment AST type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], definite: true, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [85, 86], loc: { @@ -28,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-definite-assignment AST end: { column: 3, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -64,9 +70,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-definite-assignment AST end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [79, 80], loc: { @@ -74,6 +84,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-definite-assignment AST end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 98], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-and-implements/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-and-implements/snapshots/1-TSESTree-AST.shot index b2121f97ee8..978a734675b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-and-implements/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-and-implements/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,9 +17,13 @@ Program { end: { column: 80, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "ClassWithParentAndInterface", + optional: false, range: [79, 106], loc: { @@ -31,7 +36,9 @@ Program { type: "TSClassImplements", expression: Identifier { type: "Identifier", + decorators: Array [], name: "MyInterface", + optional: false, range: [139, 150], loc: { @@ -49,7 +56,9 @@ Program { ], superClass: Identifier { type: "Identifier", + decorators: Array [], name: "MyOtherClass", + optional: false, range: [115, 127], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-and-implements/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-and-implements/snapshots/5-AST-Alignment-AST.shot index bb0b1427d25..9345b10e985 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-and-implements/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-and-implements/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-and-implements A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-and-implements A end: { column: 80, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'ClassWithParentAndInterface', +- optional: false, range: [79, 106], loc: { @@ -37,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-and-implements A + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'MyInterface', +- optional: false, range: [139, 150], loc: { @@ -55,7 +62,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-and-implements A ], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'MyOtherClass', +- optional: false, range: [115, 127], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/1-TSESTree-AST.shot index ded2419b191..00c4174cb44 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,9 +17,13 @@ Program { end: { column: 43, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -26,9 +31,12 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: Identifier { type: "Identifier", + decorators: Array [], name: "Bar", + optional: false, range: [104, 107], loc: { @@ -43,7 +51,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "C", + optional: false, range: [108, 109], loc: { @@ -62,7 +72,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "D", + optional: false, range: [111, 112], loc: { @@ -92,7 +104,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "C", + optional: false, range: [108, 109], loc: { @@ -111,7 +125,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "D", + optional: false, range: [111, 112], loc: { @@ -143,7 +159,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [93, 94], loc: { @@ -161,7 +179,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [83, 84], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/5-AST-Alignment-AST.shot index ca63e23a86a..526a7b1c98d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic-multiple/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic-multiple body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic-multiple end: { column: 43, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -30,16 +35,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic-multiple end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [104, 107], loc: { start: { column: 31, line: 3 }, end: { column: 34, line: 3 }, - }, - }, +- }, +- }, - superTypeArguments: TSTypeParameterInstantiation { - type: 'TSTypeParameterInstantiation', - params: Array [ @@ -47,7 +55,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic-multiple - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'C', +- optional: false, - - range: [108, 109], - loc: { @@ -66,7 +76,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic-multiple - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'D', +- optional: false, - - range: [111, 112], - loc: { @@ -87,8 +99,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic-multiple - loc: { - start: { column: 34, line: 3 }, - end: { column: 40, line: 3 }, -- }, -- }, + }, + }, superTypeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ @@ -96,7 +108,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic-multiple type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [108, 109], loc: { @@ -115,7 +129,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic-multiple type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'D', +- optional: false, range: [111, 112], loc: { @@ -147,7 +163,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic-multiple type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [93, 94], loc: { @@ -165,7 +183,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic-multiple - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', +- optional: false, - - range: [83, 84], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/1-TSESTree-AST.shot index 0eb56ff8f7a..65e2976d5a5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,9 +17,13 @@ Program { end: { column: 30, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -26,9 +31,12 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: Identifier { type: "Identifier", + decorators: Array [], name: "Bar", + optional: false, range: [94, 97], loc: { @@ -43,7 +51,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [98, 99], loc: { @@ -73,7 +83,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [98, 99], loc: { @@ -104,7 +116,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [83, 84], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/5-AST-Alignment-AST.shot index a97ace5c3c1..2ca28ff707f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-extends-generic/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic AST Alig body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic AST Alig end: { column: 30, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -30,9 +35,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic AST Alig end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [94, 97], loc: { @@ -47,7 +55,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic AST Alig - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'B', +- optional: false, - - range: [98, 99], - loc: { @@ -77,7 +87,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic AST Alig type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [98, 99], loc: { @@ -108,7 +120,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-extends-generic AST Alig - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', +- optional: false, - - range: [83, 84], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method-default/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method-default/snapshots/1-TSESTree-AST.shot index b39f7d0995d..27aa8cb964c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method-default/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method-default/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "getBar", + optional: false, range: [87, 93], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 22, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -51,7 +57,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Bar", + optional: false, range: [98, 101], loc: { @@ -69,7 +77,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [94, 95], loc: { @@ -115,9 +125,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -125,6 +139,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 109], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method-default/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method-default/snapshots/5-AST-Alignment-AST.shot index 72b1fa15c47..95cfcac551d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method-default/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method-default/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method-default A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'getBar', +- optional: false, range: [87, 93], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method-default A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method-default A end: { column: 22, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -55,7 +61,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method-default A type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [98, 101], loc: { @@ -73,7 +81,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method-default A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [94, 95], - loc: { @@ -122,9 +132,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method-default A end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -132,6 +146,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method-default A end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 109], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method/snapshots/1-TSESTree-AST.shot index 4cb9045a5ef..855fdd657f8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "getBar", + optional: false, range: [87, 93], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 16, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -50,7 +56,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [94, 95], loc: { @@ -96,9 +104,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -106,6 +118,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 103], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method/snapshots/5-AST-Alignment-AST.shot index 6ec0c4dc779..d6074466f5c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-generic-method/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method AST Align body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'getBar', +- optional: false, range: [87, 93], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method AST Align }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method AST Align end: { column: 16, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -54,7 +60,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method AST Align - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [94, 95], - loc: { @@ -103,9 +111,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method AST Align end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -113,6 +125,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-generic-method AST Align end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 103], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/1-TSESTree-AST.shot index 9912ba6bbcc..edd1a3131b7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,9 +17,13 @@ Program { end: { column: 33, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -31,7 +36,9 @@ Program { type: "TSClassImplements", expression: Identifier { type: "Identifier", + decorators: Array [], name: "Bar", + optional: false, range: [94, 97], loc: { @@ -46,7 +53,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "S", + optional: false, range: [98, 99], loc: { @@ -65,7 +74,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [101, 102], loc: { @@ -95,7 +106,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "S", + optional: false, range: [98, 99], loc: { @@ -114,7 +127,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [101, 102], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/5-AST-Alignment-AST.shot index d85931ef054..5fe8f2ee625 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic-multiple/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic-multi body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic-multi end: { column: 33, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -37,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic-multi + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [94, 97], loc: { @@ -52,7 +59,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic-multi - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'S', +- optional: false, - - range: [98, 99], - loc: { @@ -71,7 +80,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic-multi - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [101, 102], - loc: { @@ -101,7 +112,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic-multi type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'S', +- optional: false, range: [98, 99], loc: { @@ -120,7 +133,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic-multi type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [101, 102], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/1-TSESTree-AST.shot index 75d8c33614f..51bbd96c9ba 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,9 +17,13 @@ Program { end: { column: 30, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -31,7 +36,9 @@ Program { type: "TSClassImplements", expression: Identifier { type: "Identifier", + decorators: Array [], name: "Bar", + optional: false, range: [94, 97], loc: { @@ -46,7 +53,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "S", + optional: false, range: [98, 99], loc: { @@ -76,7 +85,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "S", + optional: false, range: [98, 99], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/5-AST-Alignment-AST.shot index 2f3b5490a9d..f3a4828f755 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements-generic/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic AST A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic AST A end: { column: 30, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -37,14 +42,16 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic AST A + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [94, 97], loc: { start: { column: 21, line: 3 }, end: { column: 24, line: 3 }, -- }, -- }, + }, + }, - typeArguments: TSTypeParameterInstantiation { - type: 'TSTypeParameterInstantiation', - params: Array [ @@ -52,7 +59,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic AST A - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'S', +- optional: false, - - range: [98, 99], - loc: { @@ -73,8 +82,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic AST A - loc: { - start: { column: 24, line: 3 }, - end: { column: 27, line: 3 }, - }, - }, +- }, +- }, typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ @@ -82,7 +91,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements-generic AST A type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'S', +- optional: false, range: [98, 99], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements/snapshots/1-TSESTree-AST.shot index b2bb085367b..f8fc78a98d3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,9 +17,13 @@ Program { end: { column: 27, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -31,7 +36,9 @@ Program { type: "TSClassImplements", expression: Identifier { type: "Identifier", + decorators: Array [], name: "Bar", + optional: false, range: [94, 97], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements/snapshots/5-AST-Alignment-AST.shot index 67f56c86370..cbb9b19f345 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-implements/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements AST Alignment body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements AST Alignment end: { column: 27, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -37,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-implements AST Alignment + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [94, 97], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-method/snapshots/1-TSESTree-AST.shot index d86b4174035..832c3f13d62 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-method/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [85, 88], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 18, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -77,9 +83,12 @@ Program { MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [104, 107], loc: { @@ -88,6 +97,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -103,6 +113,7 @@ Program { end: { column: 13, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -115,7 +126,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [108, 109], loc: { @@ -156,9 +169,12 @@ Program { MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "baz", + optional: false, range: [118, 121], loc: { @@ -167,6 +183,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -182,6 +199,7 @@ Program { end: { column: 10, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -208,9 +226,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "C", + optional: false, range: [79, 80], loc: { @@ -218,6 +240,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 128], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-method/snapshots/5-AST-Alignment-AST.shot index fa3122911f7..b7f53d77c51 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-method/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [85, 88], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A end: { column: 18, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -81,9 +87,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [104, 107], loc: { @@ -92,6 +101,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -107,6 +117,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A end: { column: 13, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -119,7 +130,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [108, 109], - loc: { @@ -163,9 +176,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [118, 121], loc: { @@ -174,6 +190,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -189,6 +206,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A end: { column: 10, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -215,9 +233,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [79, 80], loc: { @@ -225,6 +247,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-method AST Alignment - A end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 128], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/1-TSESTree-AST.shot index 373d4e7bae5..710d6f21f58 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 48, line: 3 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "M", + optional: false, range: [82, 83], loc: { @@ -32,14 +35,18 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "Base", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [116, 117], loc: { @@ -83,7 +90,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "M", + optional: false, range: [106, 107], loc: { @@ -108,7 +117,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Constructor", + optional: false, range: [94, 105], loc: { @@ -123,7 +134,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "M", + optional: false, range: [106, 107], loc: { @@ -156,7 +169,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [84, 85], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/5-AST-Alignment-AST.shot index 1656c11934c..43be505fdc3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin-reference/snapshots/5-AST-Alignment-AST.shot @@ -21,11 +21,14 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin-reference AST Alig end: { column: 48, line: 3 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'M', +- optional: false, range: [82, 83], loc: { @@ -36,14 +39,18 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin-reference AST Alig params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'Base', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [116, 117], loc: { @@ -87,7 +94,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin-reference AST Alig - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'M', +- optional: false, - - range: [106, 107], - loc: { @@ -112,7 +121,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin-reference AST Alig - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Constructor', +- optional: false, range: [94, 105], loc: { @@ -127,7 +138,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin-reference AST Alig type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'M', +- optional: false, range: [106, 107], loc: { @@ -160,7 +173,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin-reference AST Alig - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [84, 85], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/1-TSESTree-AST.shot index 62bbd5a6d78..08032c0c974 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/1-TSESTree-AST.shot @@ -14,6 +14,7 @@ Program { type: "ReturnStatement", argument: ClassExpression { type: "ClassExpression", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -24,10 +25,15 @@ Program { end: { column: 30, line: 4 }, }, }, + declare: false, + decorators: Array [], id: null, + implements: Array [], superClass: Identifier { type: "Identifier", + decorators: Array [], name: "Base", + optional: false, range: [145, 149], loc: { @@ -57,11 +63,14 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "M", + optional: false, range: [82, 83], loc: { @@ -72,14 +81,18 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "Base", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [117, 118], loc: { @@ -139,7 +152,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Constructor", + optional: false, range: [94, 105], loc: { @@ -178,7 +193,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [84, 85], loc: { @@ -211,6 +228,7 @@ Program { }, ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -221,9 +239,13 @@ Program { end: { column: 41, line: 7 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "X", + optional: false, range: [163, 164], loc: { @@ -236,7 +258,9 @@ Program { type: "TSClassImplements", expression: Identifier { type: "Identifier", + decorators: Array [], name: "I", + optional: false, range: [194, 195], loc: { @@ -257,7 +281,9 @@ Program { arguments: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "C", + optional: false, range: [180, 181], loc: { @@ -268,7 +294,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: Array [], name: "M", + optional: false, range: [173, 174], loc: { @@ -333,6 +361,7 @@ Program { }, ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -343,9 +372,13 @@ Program { end: { column: 10, line: 9 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "C", + optional: false, range: [206, 207], loc: { @@ -353,6 +386,7 @@ Program { end: { column: 7, line: 9 }, }, }, + implements: Array [], superClass: null, range: [200, 210], @@ -373,9 +407,13 @@ Program { end: { column: 14, line: 10 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "I", + optional: false, range: [221, 222], loc: { @@ -392,9 +430,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Constructor", + optional: false, range: [231, 242], loc: { @@ -410,7 +451,9 @@ Program { type: "RestElement", argument: Identifier { type: "Identifier", + decorators: Array [], name: "args", + optional: false, range: [256, 260], loc: { @@ -418,6 +461,8 @@ Program { end: { column: 34, line: 11 }, }, }, + decorators: Array [], + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSArrayType { @@ -459,7 +504,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [272, 273], loc: { @@ -496,7 +543,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [243, 244], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/5-AST-Alignment-AST.shot index 6b48e3e25a5..2a217b40d79 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-mixin/snapshots/5-AST-Alignment-AST.shot @@ -18,6 +18,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS type: 'ReturnStatement', argument: ClassExpression { type: 'ClassExpression', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -28,10 +29,15 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS end: { column: 30, line: 4 }, }, }, +- declare: false, +- decorators: Array [], id: null, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Base', +- optional: false, range: [145, 149], loc: { @@ -61,11 +67,14 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS end: { column: 1, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'M', +- optional: false, range: [82, 83], loc: { @@ -76,14 +85,18 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'Base', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [117, 118], loc: { @@ -143,7 +156,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Constructor', +- optional: false, range: [94, 105], loc: { @@ -182,7 +197,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [84, 85], - loc: { @@ -216,6 +233,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS }, ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -226,9 +244,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS end: { column: 41, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [163, 164], loc: { @@ -243,7 +265,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'I', +- optional: false, range: [194, 195], loc: { @@ -264,7 +288,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS arguments: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [180, 181], loc: { @@ -275,7 +301,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'M', +- optional: false, range: [173, 174], loc: { @@ -340,6 +368,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS }, ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -350,9 +379,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS end: { column: 10, line: 9 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [206, 207], loc: { @@ -360,6 +393,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS end: { column: 7, line: 9 }, }, }, +- implements: Array [], superClass: null, range: [200, 210], @@ -380,9 +414,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS end: { column: 14, line: 10 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'I', +- optional: false, range: [221, 222], loc: { @@ -399,9 +437,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Constructor', +- optional: false, range: [231, 242], loc: { @@ -418,7 +459,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS type: 'RestElement', argument: Identifier { type: 'Identifier', +- decorators: Array [], name: 'args', +- optional: false, range: [256, 260], loc: { @@ -426,6 +469,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS end: { column: 34, line: 11 }, }, }, +- decorators: Array [], +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSArrayType { @@ -468,7 +513,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [272, 273], loc: { @@ -505,7 +552,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-mixin AST Alignment - AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [243, 244], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-method/snapshots/1-TSESTree-AST.shot index 04e6998c422..1c97eb0186f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-method/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "computed1", + optional: false, range: [79, 88], loc: { @@ -38,6 +41,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [73, 98], @@ -51,9 +55,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "computed2", + optional: false, range: [105, 114], loc: { @@ -80,6 +87,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [99, 124], @@ -93,9 +101,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "obj", + optional: false, range: [131, 134], loc: { @@ -111,7 +122,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "member", + optional: false, range: [141, 147], loc: { @@ -121,6 +134,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: Literal { type: "Literal", @@ -145,7 +159,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "member2", + optional: false, range: [161, 168], loc: { @@ -155,6 +171,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: Literal { type: "Literal", @@ -190,6 +207,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [125, 183], @@ -200,15 +218,19 @@ Program { }, ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: true, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "computed1", + optional: false, range: [197, 206], loc: { @@ -224,6 +246,7 @@ Program { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -245,9 +268,12 @@ Program { MethodDefinition { type: "MethodDefinition", computed: true, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "computed2", + optional: false, range: [215, 224], loc: { @@ -272,6 +298,7 @@ Program { end: { column: 19, line: 11 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -293,6 +320,7 @@ Program { MethodDefinition { type: "MethodDefinition", computed: true, + decorators: Array [], key: Literal { type: "Literal", raw: "1", @@ -312,6 +340,7 @@ Program { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -333,6 +362,7 @@ Program { MethodDefinition { type: "MethodDefinition", computed: true, + decorators: Array [], key: Literal { type: "Literal", raw: "2", @@ -361,6 +391,7 @@ Program { end: { column: 11, line: 13 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -382,6 +413,7 @@ Program { MethodDefinition { type: "MethodDefinition", computed: true, + decorators: Array [], key: Literal { type: "Literal", raw: "'literal1'", @@ -401,6 +433,7 @@ Program { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -422,6 +455,7 @@ Program { MethodDefinition { type: "MethodDefinition", computed: true, + decorators: Array [], key: Literal { type: "Literal", raw: "'literal2'", @@ -450,6 +484,7 @@ Program { end: { column: 20, line: 15 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -471,12 +506,15 @@ Program { MethodDefinition { type: "MethodDefinition", computed: true, + decorators: Array [], key: MemberExpression { type: "MemberExpression", computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "obj", + optional: false, range: [297, 300], loc: { @@ -487,7 +525,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "member", + optional: false, range: [301, 307], loc: { @@ -519,6 +559,7 @@ Program { end: { column: 20, line: 16 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -540,12 +581,15 @@ Program { MethodDefinition { type: "MethodDefinition", computed: true, + decorators: Array [], key: MemberExpression { type: "MemberExpression", computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "obj", + optional: false, range: [318, 321], loc: { @@ -556,7 +600,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "member2", + optional: false, range: [322, 329], loc: { @@ -579,6 +625,7 @@ Program { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -600,12 +647,15 @@ Program { MethodDefinition { type: "MethodDefinition", computed: true, + decorators: Array [], key: CallExpression { type: "CallExpression", arguments: Array [], callee: Identifier { type: "Identifier", + decorators: Array [], name: "f", + optional: false, range: [338, 339], loc: { @@ -638,6 +688,7 @@ Program { end: { column: 13, line: 18 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -664,9 +715,13 @@ Program { end: { column: 1, line: 19 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "X", + optional: false, range: [190, 191], loc: { @@ -674,6 +729,7 @@ Program { end: { column: 7, line: 9 }, }, }, + implements: Array [], superClass: null, range: [184, 350], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-method/snapshots/5-AST-Alignment-AST.shot index 0adc9129ec5..a99eafba664 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-method/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'computed1', +- optional: false, range: [79, 88], loc: { @@ -42,6 +45,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method }, }, ], +- declare: false, kind: 'const', range: [73, 98], @@ -55,9 +59,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'computed2', +- optional: false, range: [105, 114], loc: { @@ -84,6 +91,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method }, }, ], +- declare: false, kind: 'const', range: [99, 124], @@ -97,9 +105,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'obj', +- optional: false, range: [131, 134], loc: { @@ -115,7 +126,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'member', +- optional: false, range: [141, 147], loc: { @@ -125,6 +138,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method }, kind: 'init', method: false, +- optional: false, shorthand: false, value: Literal { type: 'Literal', @@ -149,7 +163,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'member2', +- optional: false, range: [161, 168], loc: { @@ -159,6 +175,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method }, kind: 'init', method: false, +- optional: false, shorthand: false, value: Literal { type: 'Literal', @@ -194,6 +211,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method }, }, ], +- declare: false, kind: 'const', range: [125, 183], @@ -204,15 +222,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method }, ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: true, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'computed1', +- optional: false, range: [197, 206], loc: { @@ -230,6 +252,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -251,9 +274,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method MethodDefinition { type: 'MethodDefinition', computed: true, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'computed2', +- optional: false, range: [215, 224], loc: { @@ -278,6 +304,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method end: { column: 19, line: 11 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -299,6 +326,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method MethodDefinition { type: 'MethodDefinition', computed: true, +- decorators: Array [], key: Literal { type: 'Literal', raw: '1', @@ -320,6 +348,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -341,6 +370,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method MethodDefinition { type: 'MethodDefinition', computed: true, +- decorators: Array [], key: Literal { type: 'Literal', raw: '2', @@ -369,6 +399,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method end: { column: 11, line: 13 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -390,6 +421,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method MethodDefinition { type: 'MethodDefinition', computed: true, +- decorators: Array [], key: Literal { type: 'Literal', raw: '\\\\'literal1\\\\'', @@ -411,6 +443,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -432,6 +465,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method MethodDefinition { type: 'MethodDefinition', computed: true, +- decorators: Array [], key: Literal { type: 'Literal', raw: '\\\\'literal2\\\\'', @@ -460,6 +494,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method end: { column: 20, line: 15 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -481,12 +516,15 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method MethodDefinition { type: 'MethodDefinition', computed: true, +- decorators: Array [], key: MemberExpression { type: 'MemberExpression', computed: false, object: Identifier { type: 'Identifier', +- decorators: Array [], name: 'obj', +- optional: false, range: [297, 300], loc: { @@ -497,7 +535,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'member', +- optional: false, range: [301, 307], loc: { @@ -529,6 +569,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method end: { column: 20, line: 16 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -550,12 +591,15 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method MethodDefinition { type: 'MethodDefinition', computed: true, +- decorators: Array [], key: MemberExpression { type: 'MemberExpression', computed: false, object: Identifier { type: 'Identifier', +- decorators: Array [], name: 'obj', +- optional: false, range: [318, 321], loc: { @@ -566,7 +610,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'member2', +- optional: false, range: [322, 329], loc: { @@ -591,6 +637,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -612,12 +659,15 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method MethodDefinition { type: 'MethodDefinition', computed: true, +- decorators: Array [], key: CallExpression { type: 'CallExpression', arguments: Array [], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'f', +- optional: false, range: [338, 339], loc: { @@ -650,6 +700,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method end: { column: 13, line: 18 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -676,9 +727,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method end: { column: 1, line: 19 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [190, 191], loc: { @@ -686,6 +741,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-method end: { column: 7, line: 9 }, }, }, +- implements: Array [], superClass: null, range: [184, 350], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-property/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-property/snapshots/1-TSESTree-AST.shot index 86bb58bff3c..541f51d6bda 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-property/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-property/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -14,6 +15,8 @@ Program { accessibility: "private", computed: true, declare: false, + decorators: Array [], + definite: false, key: Literal { type: "Literal", raw: "'foo'", @@ -27,10 +30,13 @@ Program { }, optional: true, override: false, + readonly: false, static: false, value: Identifier { type: "Identifier", + decorators: Array [], name: "undefined", + optional: false, range: [104, 113], loc: { @@ -53,9 +59,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "X", + optional: false, range: [79, 80], loc: { @@ -63,6 +73,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 116], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-property/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-property/snapshots/5-AST-Alignment-AST.shot index f12e57a2e68..17909c7085c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-property/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-computed-property/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-proper body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -18,6 +19,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-proper accessibility: 'private', computed: true, - declare: false, +- decorators: Array [], +- definite: false, key: Literal { type: 'Literal', raw: '\\\\'foo\\\\'', @@ -31,10 +34,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-proper }, optional: true, - override: false, +- readonly: false, static: false, value: Identifier { type: 'Identifier', +- decorators: Array [], name: 'undefined', +- optional: false, range: [104, 113], loc: { @@ -57,9 +63,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-proper end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [79, 80], loc: { @@ -67,6 +77,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-computed-proper end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 116], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-methods/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-methods/snapshots/1-TSESTree-AST.shot index fe3c85982bf..8051505d682 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-methods/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-methods/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [87, 90], loc: { @@ -30,6 +34,7 @@ Program { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -51,9 +56,12 @@ Program { MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [97, 100], loc: { @@ -69,6 +77,7 @@ Program { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -109,9 +118,12 @@ Program { type: "MethodDefinition", accessibility: "private", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "baz", + optional: false, range: [123, 126], loc: { @@ -127,6 +139,7 @@ Program { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -171,9 +184,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -181,6 +198,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 140], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-methods/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-methods/snapshots/5-AST-Alignment-AST.shot index 9e3032b5695..d75b7e9bb3b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-methods/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-methods/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-methods AST Ali body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [87, 90], loc: { @@ -36,6 +40,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-methods AST Ali + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -57,9 +62,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-methods AST Ali MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [97, 100], loc: { @@ -77,6 +85,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-methods AST Ali + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -117,9 +126,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-methods AST Ali type: 'MethodDefinition', accessibility: 'private', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [123, 126], loc: { @@ -137,6 +149,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-methods AST Ali + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -181,9 +194,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-methods AST Ali end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -191,6 +208,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-methods AST Ali end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 140], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-properties/snapshots/1-TSESTree-AST.shot index 7a053a8b1af..7968e9b1462 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-properties/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "computed", + optional: false, range: [79, 87], loc: { @@ -38,6 +41,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [73, 97], @@ -51,9 +55,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "computed2", + optional: false, range: [104, 113], loc: { @@ -80,6 +87,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [98, 123], @@ -90,6 +98,7 @@ Program { }, ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -97,9 +106,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [138, 141], loc: { @@ -109,6 +122,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, value: null, @@ -122,9 +136,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [146, 149], loc: { @@ -134,6 +152,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -166,9 +185,13 @@ Program { accessibility: "private", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "baz", + optional: false, range: [170, 173], loc: { @@ -178,6 +201,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -209,9 +233,13 @@ Program { type: "PropertyDefinition", computed: true, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "computed", + optional: false, range: [187, 195], loc: { @@ -221,6 +249,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, value: null, @@ -234,6 +263,8 @@ Program { type: "PropertyDefinition", computed: true, declare: false, + decorators: Array [], + definite: false, key: Literal { type: "Literal", raw: "'literal'", @@ -247,6 +278,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, value: null, @@ -260,6 +292,8 @@ Program { type: "PropertyDefinition", computed: true, declare: false, + decorators: Array [], + definite: false, key: Literal { type: "Literal", raw: "1", @@ -273,6 +307,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, value: null, @@ -286,9 +321,13 @@ Program { type: "PropertyDefinition", computed: true, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "computed2", + optional: false, range: [226, 235], loc: { @@ -298,6 +337,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -329,6 +369,8 @@ Program { type: "PropertyDefinition", computed: true, declare: false, + decorators: Array [], + definite: false, key: Literal { type: "Literal", raw: "'literal2'", @@ -342,6 +384,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -373,6 +416,8 @@ Program { type: "PropertyDefinition", computed: true, declare: false, + decorators: Array [], + definite: false, key: Literal { type: "Literal", raw: "2", @@ -386,6 +431,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -421,9 +467,13 @@ Program { end: { column: 1, line: 15 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [130, 133], loc: { @@ -431,6 +481,7 @@ Program { end: { column: 9, line: 5 }, }, }, + implements: Array [], superClass: null, range: [124, 289], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-properties/snapshots/5-AST-Alignment-AST.shot index 12a4a2288c9..0d54d2e7bab 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-properties/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'computed', +- optional: false, range: [79, 87], loc: { @@ -42,6 +45,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, }, ], +- declare: false, kind: 'const', range: [73, 97], @@ -55,9 +59,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'computed2', +- optional: false, range: [104, 113], loc: { @@ -84,6 +91,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, }, ], +- declare: false, kind: 'const', range: [98, 123], @@ -94,6 +102,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -101,9 +110,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [138, 141], loc: { @@ -113,6 +126,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, optional: true, - override: false, +- readonly: false, static: false, value: null, @@ -126,9 +140,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [146, 149], loc: { @@ -138,6 +156,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, optional: true, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -170,9 +189,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST accessibility: 'private', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [170, 173], loc: { @@ -182,6 +205,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, optional: true, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -213,9 +237,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST type: 'PropertyDefinition', computed: true, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'computed', +- optional: false, range: [187, 195], loc: { @@ -225,6 +253,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, optional: true, - override: false, +- readonly: false, static: false, value: null, @@ -238,6 +267,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST type: 'PropertyDefinition', computed: true, - declare: false, +- decorators: Array [], +- definite: false, key: Literal { type: 'Literal', raw: '\\\\'literal\\\\'', @@ -251,6 +282,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, optional: true, - override: false, +- readonly: false, static: false, value: null, @@ -264,6 +296,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST type: 'PropertyDefinition', computed: true, - declare: false, +- decorators: Array [], +- definite: false, key: Literal { type: 'Literal', raw: '1', @@ -277,6 +311,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, optional: true, - override: false, +- readonly: false, static: false, value: null, @@ -290,9 +325,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST type: 'PropertyDefinition', computed: true, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'computed2', +- optional: false, range: [226, 235], loc: { @@ -302,6 +341,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, optional: true, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -333,6 +373,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST type: 'PropertyDefinition', computed: true, - declare: false, +- decorators: Array [], +- definite: false, key: Literal { type: 'Literal', raw: '\\\\'literal2\\\\'', @@ -346,6 +388,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, optional: true, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -377,6 +420,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST type: 'PropertyDefinition', computed: true, - declare: false, +- decorators: Array [], +- definite: false, key: Literal { type: 'Literal', raw: '2', @@ -390,6 +435,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST }, optional: true, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -425,9 +471,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST end: { column: 1, line: 15 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [130, 133], loc: { @@ -435,6 +485,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-properties AST end: { column: 9, line: 5 }, }, }, +- implements: Array [], superClass: null, range: [124, 289], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-property-undefined/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-property-undefined/snapshots/1-TSESTree-AST.shot index cf99a1d0ba5..eab4228cf85 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-property-undefined/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-property-undefined/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -14,9 +15,13 @@ Program { accessibility: "private", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [93, 96], loc: { @@ -26,10 +31,13 @@ Program { }, optional: true, override: false, + readonly: false, static: false, value: Identifier { type: "Identifier", + decorators: Array [], name: "undefined", + optional: false, range: [100, 109], loc: { @@ -52,9 +60,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "X", + optional: false, range: [79, 80], loc: { @@ -62,6 +74,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 112], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-property-undefined/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-property-undefined/snapshots/5-AST-Alignment-AST.shot index bf276da33e3..c720da83ff5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-property-undefined/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-optional-property-undefined/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-property-undefi body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -18,9 +19,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-property-undefi accessibility: 'private', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [93, 96], loc: { @@ -30,10 +35,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-property-undefi }, optional: true, - override: false, +- readonly: false, static: false, value: Identifier { type: 'Identifier', +- decorators: Array [], name: 'undefined', +- optional: false, range: [100, 109], loc: { @@ -56,9 +64,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-property-undefi end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [79, 80], loc: { @@ -66,6 +78,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-optional-property-undefi end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 112], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-method/snapshots/1-TSESTree-AST.shot index 2d3330021e7..ad7725d2cde 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-method/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "show", + optional: false, range: [135, 139], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: true, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -64,9 +70,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "SpecializedComponent", + optional: false, range: [79, 99], loc: { @@ -74,9 +84,12 @@ Program { end: { column: 26, line: 3 }, }, }, + implements: Array [], superClass: Identifier { type: "Identifier", + decorators: Array [], name: "SomeComponent", + optional: false, range: [108, 121], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-method/snapshots/5-AST-Alignment-AST.shot index 6d916c72d85..1d2e6f791ee 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-method/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,119 @@ exports[`AST Fixtures legacy-fixtures basics class-with-override-method AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [ + MethodDefinition { + type: 'MethodDefinition', + computed: false, +- decorators: Array [], + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'show', +- optional: false, + + range: [135, 139], + loc: { + start: { column: 11, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + kind: 'method', +- optional: false, + override: true, + static: false, + value: FunctionExpression { + type: 'FunctionExpression', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [142, 158], + loc: { + start: { column: 18, line: 4 }, + end: { column: 3, line: 6 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: null, + params: Array [], + + range: [139, 158], + loc: { + start: { column: 15, line: 4 }, + end: { column: 3, line: 6 }, + }, + }, + + range: [126, 158], + loc: { + start: { column: 2, line: 4 }, + end: { column: 3, line: 6 }, + }, + }, + ], + + range: [122, 160], + loc: { + start: { column: 49, line: 3 }, + end: { column: 1, line: 7 }, + }, + }, +- declare: false, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'SpecializedComponent', +- optional: false, + + range: [79, 99], + loc: { + start: { column: 6, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, +- implements: Array [], + superClass: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'SomeComponent', +- optional: false, + + range: [108, 121], + loc: { + start: { column: 35, line: 3 }, + end: { column: 48, line: 3 }, + }, + }, + + range: [73, 160], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 7 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 161], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 8 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-property/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-property/snapshots/1-TSESTree-AST.shot index 38719494d52..42296642428 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-property/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-property/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,9 +14,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [135, 138], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 14, line: 4 }, }, }, + optional: false, override: true, + readonly: false, static: false, value: Literal { type: "Literal", @@ -51,9 +58,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "SpecializedComponent", + optional: false, range: [79, 99], loc: { @@ -61,9 +72,12 @@ Program { end: { column: 26, line: 3 }, }, }, + implements: Array [], superClass: Identifier { type: "Identifier", + decorators: Array [], name: "SomeComponent", + optional: false, range: [108, 121], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-property/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-property/snapshots/5-AST-Alignment-AST.shot index 644f6e34e87..78cbdbf91c7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-property/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-override-property/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-override-property AST Al body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,9 +18,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-override-property AST Al type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [135, 138], loc: { @@ -27,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-override-property AST Al end: { column: 14, line: 4 }, }, }, +- optional: false, override: true, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -55,9 +62,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-override-property AST Al end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'SpecializedComponent', +- optional: false, range: [79, 99], loc: { @@ -65,9 +76,12 @@ exports[`AST Fixtures legacy-fixtures basics class-with-override-property AST Al end: { column: 26, line: 3 }, }, }, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'SomeComponent', +- optional: false, range: [108, 121], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-optional-property/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-optional-property/snapshots/1-TSESTree-AST.shot index c6c2cfcc51b..e2d3b20c069 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-optional-property/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-optional-property/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,6 +14,8 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: PrivateIdentifier { type: "PrivateIdentifier", name: "prop", @@ -25,6 +28,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -56,6 +60,8 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: PrivateIdentifier { type: "PrivateIdentifier", name: "propExplicitWithValue", @@ -68,6 +74,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -109,6 +116,8 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: PrivateIdentifier { type: "PrivateIdentifier", name: "propImplicitWithValue", @@ -121,6 +130,7 @@ Program { }, optional: true, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -148,9 +158,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -158,6 +172,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 176], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-optional-property/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-optional-property/snapshots/5-AST-Alignment-AST.shot index a6626a65084..16aae706582 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-optional-property/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-optional-property/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-optional-propert body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,6 +18,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-optional-propert type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: PrivateIdentifier { type: 'PrivateIdentifier', name: 'prop', @@ -29,6 +32,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-optional-propert }, optional: true, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -60,6 +64,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-optional-propert type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: PrivateIdentifier { type: 'PrivateIdentifier', name: 'propExplicitWithValue', @@ -72,6 +78,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-optional-propert }, optional: true, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -113,6 +120,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-optional-propert type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: PrivateIdentifier { type: 'PrivateIdentifier', name: 'propImplicitWithValue', @@ -125,6 +134,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-optional-propert }, optional: true, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -152,9 +162,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-optional-propert end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -162,6 +176,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-optional-propert end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 176], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-parameter-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-parameter-properties/snapshots/1-TSESTree-AST.shot index fb43fe5900e..d95d0b1fb32 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-parameter-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-parameter-properties/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "constructor", + optional: false, range: [87, 98], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 6, line: 9 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -45,9 +51,13 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "private", + decorators: Array [], + override: false, parameter: Identifier { type: "Identifier", + decorators: Array [], name: "firstName", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -73,6 +83,8 @@ Program { end: { column: 29, line: 5 }, }, }, + readonly: false, + static: false, range: [104, 129], loc: { @@ -83,9 +95,13 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "private", + decorators: Array [], + override: false, parameter: Identifier { type: "Identifier", + decorators: Array [], name: "lastName", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -112,6 +128,7 @@ Program { }, }, readonly: true, + static: false, range: [135, 168], loc: { @@ -122,11 +139,16 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "private", + decorators: Array [], + override: false, parameter: AssignmentPattern { type: "AssignmentPattern", + decorators: Array [], left: Identifier { type: "Identifier", + decorators: Array [], name: "age", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -152,6 +174,7 @@ Program { end: { column: 23, line: 7 }, }, }, + optional: false, right: Literal { type: "Literal", raw: "30", @@ -170,6 +193,8 @@ Program { end: { column: 28, line: 7 }, }, }, + readonly: false, + static: false, range: [174, 198], loc: { @@ -180,11 +205,16 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "private", + decorators: Array [], + override: false, parameter: AssignmentPattern { type: "AssignmentPattern", + decorators: Array [], left: Identifier { type: "Identifier", + decorators: Array [], name: "student", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSBooleanKeyword { @@ -210,6 +240,7 @@ Program { end: { column: 37, line: 8 }, }, }, + optional: false, right: Literal { type: "Literal", raw: "false", @@ -229,6 +260,7 @@ Program { }, }, readonly: true, + static: false, range: [204, 245], loc: { @@ -259,9 +291,13 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -269,6 +305,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 255], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-parameter-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-parameter-properties/snapshots/5-AST-Alignment-AST.shot index ff7c7f9bdd3..e4442ac9ee3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-parameter-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-private-parameter-properties/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [87, 98], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper end: { column: 6, line: 9 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -49,9 +55,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper TSParameterProperty { type: 'TSParameterProperty', accessibility: 'private', +- decorators: Array [], +- override: false, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'firstName', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -77,6 +87,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper end: { column: 29, line: 5 }, }, }, +- readonly: false, +- static: false, range: [104, 129], loc: { @@ -87,9 +99,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper TSParameterProperty { type: 'TSParameterProperty', accessibility: 'private', +- decorators: Array [], +- override: false, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'lastName', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -116,6 +132,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper }, }, readonly: true, +- static: false, range: [135, 168], loc: { @@ -126,11 +143,16 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper TSParameterProperty { type: 'TSParameterProperty', accessibility: 'private', +- decorators: Array [], +- override: false, parameter: AssignmentPattern { type: 'AssignmentPattern', +- decorators: Array [], left: Identifier { type: 'Identifier', +- decorators: Array [], name: 'age', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -156,6 +178,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper end: { column: 23, line: 7 }, }, }, +- optional: false, right: Literal { type: 'Literal', raw: '30', @@ -174,6 +197,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper end: { column: 28, line: 7 }, }, }, +- readonly: false, +- static: false, range: [174, 198], loc: { @@ -184,11 +209,16 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper TSParameterProperty { type: 'TSParameterProperty', accessibility: 'private', +- decorators: Array [], +- override: false, parameter: AssignmentPattern { type: 'AssignmentPattern', +- decorators: Array [], left: Identifier { type: 'Identifier', +- decorators: Array [], name: 'student', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSBooleanKeyword { @@ -214,6 +244,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper end: { column: 37, line: 8 }, }, }, +- optional: false, right: Literal { type: 'Literal', raw: 'false', @@ -233,6 +264,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper }, }, readonly: true, +- static: false, range: [204, 245], loc: { @@ -263,9 +295,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper end: { column: 1, line: 10 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -273,6 +309,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-private-parameter-proper end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 255], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-function/snapshots/1-TSESTree-AST.shot index d8a5df9e106..05f952982a4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-function/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,9 +14,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [87, 90], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 5, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -116,9 +123,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [131, 134], loc: { @@ -126,7 +137,9 @@ Program { end: { column: 5, line: 5 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -151,7 +164,9 @@ Program { async: false, body: Identifier { type: "Identifier", + decorators: Array [], name: "test", + optional: false, range: [151, 155], loc: { @@ -185,9 +200,13 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -195,6 +214,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 158], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-function/snapshots/5-AST-Alignment-AST.shot index bcee1481572..fb9a4cf2fd1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-function/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-function AST Al body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,9 +18,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-function AST Al type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [87, 90], loc: { @@ -27,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-function AST Al end: { column: 5, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -122,9 +129,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-function AST Al type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [131, 134], loc: { @@ -132,7 +143,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-function AST Al end: { column: 5, line: 5 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -157,7 +170,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-function AST Al async: false, body: Identifier { type: 'Identifier', +- decorators: Array [], name: 'test', +- optional: false, range: [151, 155], loc: { @@ -191,9 +206,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-function AST Al end: { column: 1, line: 6 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -201,6 +220,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-function AST Al end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 158], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-values/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-values/snapshots/1-TSESTree-AST.shot index adc96878555..ec2e0a5d30c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-values/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-values/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,9 +14,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [87, 88], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 3, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -47,9 +54,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [96, 97], loc: { @@ -57,7 +68,9 @@ Program { end: { column: 3, line: 5 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: ObjectExpression { type: "ObjectExpression", @@ -80,9 +93,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "c", + optional: false, range: [106, 107], loc: { @@ -90,7 +107,9 @@ Program { end: { column: 3, line: 6 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: ArrayExpression { type: "ArrayExpression", @@ -113,9 +132,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "d", + optional: false, range: [116, 117], loc: { @@ -123,7 +146,9 @@ Program { end: { column: 3, line: 7 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -147,9 +172,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "e", + optional: false, range: [126, 127], loc: { @@ -157,7 +186,9 @@ Program { end: { column: 3, line: 8 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: NewExpression { type: "NewExpression", @@ -207,7 +238,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: Array [], name: "Array", + optional: false, range: [134, 139], loc: { @@ -237,9 +270,13 @@ Program { end: { column: 1, line: 9 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -247,6 +284,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 155], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-values/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-values/snapshots/5-AST-Alignment-AST.shot index 79808b9eccf..47411d54e78 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-values/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-property-values/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,9 +18,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [87, 88], loc: { @@ -27,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig end: { column: 3, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -51,9 +58,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [96, 97], loc: { @@ -61,7 +72,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig end: { column: 3, line: 5 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: ObjectExpression { type: 'ObjectExpression', @@ -84,9 +97,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'c', +- optional: false, range: [106, 107], loc: { @@ -94,7 +111,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig end: { column: 3, line: 6 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: ArrayExpression { type: 'ArrayExpression', @@ -117,9 +136,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'd', +- optional: false, range: [116, 117], loc: { @@ -127,7 +150,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig end: { column: 3, line: 7 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -151,9 +176,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'e', +- optional: false, range: [126, 127], loc: { @@ -161,7 +190,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig end: { column: 3, line: 8 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: NewExpression { type: 'NewExpression', @@ -211,7 +242,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Array', +- optional: false, range: [134, 139], loc: { @@ -241,9 +274,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig end: { column: 1, line: 9 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -251,6 +288,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-property-values AST Alig end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 155], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-protected-parameter-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-protected-parameter-properties/snapshots/1-TSESTree-AST.shot index 39118591b24..e7681a262b3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-protected-parameter-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-protected-parameter-properties/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "constructor", + optional: false, range: [87, 98], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 6, line: 9 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -45,9 +51,13 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "protected", + decorators: Array [], + override: false, parameter: Identifier { type: "Identifier", + decorators: Array [], name: "firstName", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -73,6 +83,8 @@ Program { end: { column: 31, line: 5 }, }, }, + readonly: false, + static: false, range: [104, 131], loc: { @@ -83,9 +95,13 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "protected", + decorators: Array [], + override: false, parameter: Identifier { type: "Identifier", + decorators: Array [], name: "lastName", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -112,6 +128,7 @@ Program { }, }, readonly: true, + static: false, range: [137, 172], loc: { @@ -122,11 +139,16 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "protected", + decorators: Array [], + override: false, parameter: AssignmentPattern { type: "AssignmentPattern", + decorators: Array [], left: Identifier { type: "Identifier", + decorators: Array [], name: "age", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -152,6 +174,7 @@ Program { end: { column: 25, line: 7 }, }, }, + optional: false, right: Literal { type: "Literal", raw: "30", @@ -170,6 +193,8 @@ Program { end: { column: 30, line: 7 }, }, }, + readonly: false, + static: false, range: [178, 204], loc: { @@ -180,11 +205,16 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "protected", + decorators: Array [], + override: false, parameter: AssignmentPattern { type: "AssignmentPattern", + decorators: Array [], left: Identifier { type: "Identifier", + decorators: Array [], name: "student", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSBooleanKeyword { @@ -210,6 +240,7 @@ Program { end: { column: 39, line: 8 }, }, }, + optional: false, right: Literal { type: "Literal", raw: "false", @@ -229,6 +260,7 @@ Program { }, }, readonly: true, + static: false, range: [210, 253], loc: { @@ -259,9 +291,13 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -269,6 +305,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 263], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-protected-parameter-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-protected-parameter-properties/snapshots/5-AST-Alignment-AST.shot index 74a8495047c..ad237190d0e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-protected-parameter-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-protected-parameter-properties/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [87, 98], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop end: { column: 6, line: 9 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -49,9 +55,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop TSParameterProperty { type: 'TSParameterProperty', accessibility: 'protected', +- decorators: Array [], +- override: false, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'firstName', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -77,6 +87,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop end: { column: 31, line: 5 }, }, }, +- readonly: false, +- static: false, range: [104, 131], loc: { @@ -87,9 +99,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop TSParameterProperty { type: 'TSParameterProperty', accessibility: 'protected', +- decorators: Array [], +- override: false, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'lastName', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -116,6 +132,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop }, }, readonly: true, +- static: false, range: [137, 172], loc: { @@ -126,11 +143,16 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop TSParameterProperty { type: 'TSParameterProperty', accessibility: 'protected', +- decorators: Array [], +- override: false, parameter: AssignmentPattern { type: 'AssignmentPattern', +- decorators: Array [], left: Identifier { type: 'Identifier', +- decorators: Array [], name: 'age', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -156,6 +178,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop end: { column: 25, line: 7 }, }, }, +- optional: false, right: Literal { type: 'Literal', raw: '30', @@ -174,6 +197,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop end: { column: 30, line: 7 }, }, }, +- readonly: false, +- static: false, range: [178, 204], loc: { @@ -184,11 +209,16 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop TSParameterProperty { type: 'TSParameterProperty', accessibility: 'protected', +- decorators: Array [], +- override: false, parameter: AssignmentPattern { type: 'AssignmentPattern', +- decorators: Array [], left: Identifier { type: 'Identifier', +- decorators: Array [], name: 'student', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSBooleanKeyword { @@ -214,6 +244,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop end: { column: 39, line: 8 }, }, }, +- optional: false, right: Literal { type: 'Literal', raw: 'false', @@ -233,6 +264,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop }, }, readonly: true, +- static: false, range: [210, 253], loc: { @@ -263,9 +295,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop end: { column: 1, line: 10 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -273,6 +309,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-protected-parameter-prop end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 263], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-public-parameter-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-public-parameter-properties/snapshots/1-TSESTree-AST.shot index bcc00df90c9..66a1cc51fa3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-public-parameter-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-public-parameter-properties/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "constructor", + optional: false, range: [87, 98], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 6, line: 9 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -45,9 +51,13 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "public", + decorators: Array [], + override: false, parameter: Identifier { type: "Identifier", + decorators: Array [], name: "firstName", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -73,6 +83,8 @@ Program { end: { column: 28, line: 5 }, }, }, + readonly: false, + static: false, range: [104, 128], loc: { @@ -83,9 +95,13 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "public", + decorators: Array [], + override: false, parameter: Identifier { type: "Identifier", + decorators: Array [], name: "lastName", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -112,6 +128,7 @@ Program { }, }, readonly: true, + static: false, range: [134, 166], loc: { @@ -122,11 +139,16 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "public", + decorators: Array [], + override: false, parameter: AssignmentPattern { type: "AssignmentPattern", + decorators: Array [], left: Identifier { type: "Identifier", + decorators: Array [], name: "age", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -152,6 +174,7 @@ Program { end: { column: 22, line: 7 }, }, }, + optional: false, right: Literal { type: "Literal", raw: "30", @@ -170,6 +193,8 @@ Program { end: { column: 27, line: 7 }, }, }, + readonly: false, + static: false, range: [172, 195], loc: { @@ -180,11 +205,16 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "public", + decorators: Array [], + override: false, parameter: AssignmentPattern { type: "AssignmentPattern", + decorators: Array [], left: Identifier { type: "Identifier", + decorators: Array [], name: "student", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSBooleanKeyword { @@ -210,6 +240,7 @@ Program { end: { column: 36, line: 8 }, }, }, + optional: false, right: Literal { type: "Literal", raw: "false", @@ -229,6 +260,7 @@ Program { }, }, readonly: true, + static: false, range: [201, 241], loc: { @@ -259,9 +291,13 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -269,6 +305,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 251], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-public-parameter-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-public-parameter-properties/snapshots/5-AST-Alignment-AST.shot index ce5f1910bb7..44c167b1a1e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-public-parameter-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-public-parameter-properties/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [87, 98], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert end: { column: 6, line: 9 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -49,9 +55,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert TSParameterProperty { type: 'TSParameterProperty', accessibility: 'public', +- decorators: Array [], +- override: false, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'firstName', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -77,6 +87,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert end: { column: 28, line: 5 }, }, }, +- readonly: false, +- static: false, range: [104, 128], loc: { @@ -87,9 +99,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert TSParameterProperty { type: 'TSParameterProperty', accessibility: 'public', +- decorators: Array [], +- override: false, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'lastName', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -116,6 +132,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert }, }, readonly: true, +- static: false, range: [134, 166], loc: { @@ -126,11 +143,16 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert TSParameterProperty { type: 'TSParameterProperty', accessibility: 'public', +- decorators: Array [], +- override: false, parameter: AssignmentPattern { type: 'AssignmentPattern', +- decorators: Array [], left: Identifier { type: 'Identifier', +- decorators: Array [], name: 'age', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -156,6 +178,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert end: { column: 22, line: 7 }, }, }, +- optional: false, right: Literal { type: 'Literal', raw: '30', @@ -174,6 +197,8 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert end: { column: 27, line: 7 }, }, }, +- readonly: false, +- static: false, range: [172, 195], loc: { @@ -184,11 +209,16 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert TSParameterProperty { type: 'TSParameterProperty', accessibility: 'public', +- decorators: Array [], +- override: false, parameter: AssignmentPattern { type: 'AssignmentPattern', +- decorators: Array [], left: Identifier { type: 'Identifier', +- decorators: Array [], name: 'student', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSBooleanKeyword { @@ -214,6 +244,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert end: { column: 36, line: 8 }, }, }, +- optional: false, right: Literal { type: 'Literal', raw: 'false', @@ -233,6 +264,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert }, }, readonly: true, +- static: false, range: [201, 241], loc: { @@ -263,9 +295,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert end: { column: 1, line: 10 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -273,6 +309,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-public-parameter-propert end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 251], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-parameter-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-parameter-properties/snapshots/1-TSESTree-AST.shot index 58a500e86b4..1338e39c696 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-parameter-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-parameter-properties/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "constructor", + optional: false, range: [87, 98], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,15 +43,20 @@ Program { end: { column: 6, line: 7 }, }, }, + declare: false, expression: false, generator: false, id: null, params: Array [ TSParameterProperty { type: "TSParameterProperty", + decorators: Array [], + override: false, parameter: Identifier { type: "Identifier", + decorators: Array [], name: "firstName", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -73,6 +83,7 @@ Program { }, }, readonly: true, + static: false, range: [104, 130], loc: { @@ -82,11 +93,16 @@ Program { }, TSParameterProperty { type: "TSParameterProperty", + decorators: Array [], + override: false, parameter: AssignmentPattern { type: "AssignmentPattern", + decorators: Array [], left: Identifier { type: "Identifier", + decorators: Array [], name: "lastName", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -112,6 +128,7 @@ Program { end: { column: 29, line: 6 }, }, }, + optional: false, right: Literal { type: "Literal", raw: "'Smith'", @@ -131,6 +148,7 @@ Program { }, }, readonly: true, + static: false, range: [136, 171], loc: { @@ -161,9 +179,13 @@ Program { end: { column: 1, line: 8 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -171,6 +193,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 181], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-parameter-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-parameter-properties/snapshots/5-AST-Alignment-AST.shot index c3267c2f1f7..033382ce2d2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-parameter-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-parameter-properties/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-parameter-prope body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [87, 98], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-parameter-prope }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,15 +47,20 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-parameter-prope end: { column: 6, line: 7 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ TSParameterProperty { type: 'TSParameterProperty', +- decorators: Array [], +- override: false, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'firstName', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -77,6 +87,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-parameter-prope }, }, readonly: true, +- static: false, range: [104, 130], loc: { @@ -86,11 +97,16 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-parameter-prope }, TSParameterProperty { type: 'TSParameterProperty', +- decorators: Array [], +- override: false, parameter: AssignmentPattern { type: 'AssignmentPattern', +- decorators: Array [], left: Identifier { type: 'Identifier', +- decorators: Array [], name: 'lastName', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -116,6 +132,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-parameter-prope end: { column: 29, line: 6 }, }, }, +- optional: false, right: Literal { type: 'Literal', raw: '\\\\'Smith\\\\'', @@ -135,6 +152,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-parameter-prope }, }, readonly: true, +- static: false, range: [136, 171], loc: { @@ -165,9 +183,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-parameter-prope end: { column: 1, line: 8 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -175,6 +197,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-parameter-prope end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 181], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-property/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-property/snapshots/1-TSESTree-AST.shot index 3bdd5c14111..d58104aa7a3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-property/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-property/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -14,9 +15,13 @@ Program { accessibility: "public", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [103, 106], loc: { @@ -24,6 +29,7 @@ Program { end: { column: 21, line: 4 }, }, }, + optional: false, override: false, readonly: true, static: false, @@ -53,9 +59,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -63,6 +73,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 120], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-property/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-property/snapshots/5-AST-Alignment-AST.shot index 94c72eab163..8cb7b1cf139 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-property/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-readonly-property/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-property AST Al body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -18,9 +19,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-property AST Al accessibility: 'public', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [103, 106], loc: { @@ -28,6 +33,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-property AST Al end: { column: 21, line: 4 }, }, }, +- optional: false, - override: false, readonly: true, static: false, @@ -57,9 +63,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-property AST Al end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -67,6 +77,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-readonly-property AST Al end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 120], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-default/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-default/snapshots/1-TSESTree-AST.shot index 7bf59de03da..abd2c0d18e0 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-default/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-default/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,9 +17,13 @@ Program { end: { column: 21, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -26,6 +31,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -36,7 +42,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Bar", + optional: false, range: [87, 90], loc: { @@ -54,7 +62,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [83, 84], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-default/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-default/snapshots/5-AST-Alignment-AST.shot index efd120448d3..01dff90b136 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-default/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-default/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter-default A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter-default A end: { column: 21, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -30,6 +35,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter-default A end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -40,7 +46,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter-default A type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [87, 90], loc: { @@ -58,7 +66,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter-default A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [83, 84], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-underscore/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-underscore/snapshots/1-TSESTree-AST.shot index 11e13c3a1d9..49f71315496 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-underscore/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-underscore/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,9 +17,13 @@ Program { end: { column: 15, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [79, 80], loc: { @@ -26,6 +31,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -35,7 +41,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "__P", + optional: false, range: [81, 84], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-underscore/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-underscore/snapshots/5-AST-Alignment-AST.shot index da8b2d5230b..9e51e621595 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-underscore/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter-underscore/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter-underscor body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter-underscor end: { column: 15, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [79, 80], loc: { @@ -30,6 +35,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter-underscor end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -39,7 +45,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter-underscor - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: '__P', +- optional: false, - - range: [81, 84], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter/snapshots/1-TSESTree-AST.shot index f4a699b1414..d1f6694c4b6 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,9 +17,13 @@ Program { end: { column: 15, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -26,6 +31,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -35,7 +41,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [83, 84], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter/snapshots/5-AST-Alignment-AST.shot index 28d9a945fca..2d23fa224d6 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/class-with-type-parameter/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter AST Align body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter AST Align end: { column: 15, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -30,6 +35,7 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter AST Align end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -39,7 +45,9 @@ exports[`AST Fixtures legacy-fixtures basics class-with-type-parameter AST Align - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [83, 84], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/1-TSESTree-AST.shot index c3f47c18754..d05ebbba6d4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/1-TSESTree-AST.shot @@ -7,9 +7,12 @@ Program { TSEnumDeclaration { type: "TSEnumDeclaration", const: true, + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [84, 87], loc: { @@ -20,9 +23,12 @@ Program { members: Array [ TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [92, 95], loc: { @@ -50,9 +56,12 @@ Program { }, TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [103, 106], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/5-AST-Alignment-AST.shot index 51feccb1a78..3ca65220e22 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/const-enum/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,99 @@ exports[`AST Fixtures legacy-fixtures basics const-enum AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSEnumDeclaration { + type: 'TSEnumDeclaration', + const: true, +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [84, 87], + loc: { + start: { column: 11, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + members: Array [ + TSEnumMember { + type: 'TSEnumMember', +- computed: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [92, 95], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + initializer: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [98, 99], + loc: { + start: { column: 8, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + + range: [92, 99], + loc: { + start: { column: 2, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + TSEnumMember { + type: 'TSEnumMember', +- computed: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [103, 106], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + + range: [103, 106], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + ], + + range: [73, 109], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 110], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 7 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-class-with-optional-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-class-with-optional-method/snapshots/1-TSESTree-AST.shot index 9e10153775b..5b130af53ec 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-class-with-optional-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-class-with-optional-method/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [95, 98], loc: { @@ -30,6 +34,7 @@ Program { type: "TSEmptyBodyFunctionExpression", async: false, body: null, + declare: false, expression: false, generator: false, id: null, @@ -75,9 +80,12 @@ Program { }, }, declare: true, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [87, 90], loc: { @@ -85,6 +93,7 @@ Program { end: { column: 17, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 109], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-class-with-optional-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-class-with-optional-method/snapshots/5-AST-Alignment-AST.shot index 7d0c4c30d1a..ac37aadfa0f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-class-with-optional-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-class-with-optional-method/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics declare-class-with-optional-method body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [95, 98], loc: { @@ -36,6 +40,7 @@ exports[`AST Fixtures legacy-fixtures basics declare-class-with-optional-method + type: 'FunctionExpression', async: false, - body: null, +- declare: false, expression: false, generator: false, id: null, @@ -81,9 +86,12 @@ exports[`AST Fixtures legacy-fixtures basics declare-class-with-optional-method }, }, declare: true, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [87, 90], loc: { @@ -91,6 +99,7 @@ exports[`AST Fixtures legacy-fixtures basics declare-class-with-optional-method end: { column: 17, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 109], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-function/snapshots/1-TSESTree-AST.shot index 0c00814dcfe..bf68e456d46 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-function/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [90, 93], loc: { @@ -23,7 +25,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-function/snapshots/5-AST-Alignment-AST.shot index 286d6f2f74f..ab61cdfdda6 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/declare-function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,94 @@ exports[`AST Fixtures legacy-fixtures basics declare-function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [90, 93], + loc: { + start: { column: 17, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [99, 105], + loc: { + start: { column: 26, line: 3 }, + end: { column: 32, line: 3 }, + }, + }, + + range: [97, 105], + loc: { + start: { column: 24, line: 3 }, + end: { column: 32, line: 3 }, + }, + }, + + range: [94, 105], + loc: { + start: { column: 21, line: 3 }, + end: { column: 32, line: 3 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [108, 114], + loc: { + start: { column: 35, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + + range: [106, 114], + loc: { + start: { column: 33, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + + range: [73, 115], + loc: { + start: { column: 0, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 116], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-nested/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-nested/snapshots/1-TSESTree-AST.shot index e3d7ca759c8..4593aa2af19 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-nested/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-nested/snapshots/1-TSESTree-AST.shot @@ -10,13 +10,17 @@ Program { type: "AssignmentExpression", left: ObjectPattern { type: "ObjectPattern", + decorators: Array [], + optional: false, properties: Array [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [78, 81], loc: { @@ -26,18 +30,24 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: AssignmentPattern { type: "AssignmentPattern", + decorators: Array [], left: ObjectPattern { type: "ObjectPattern", + decorators: Array [], + optional: false, properties: Array [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [85, 88], loc: { @@ -47,18 +57,24 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: AssignmentPattern { type: "AssignmentPattern", + decorators: Array [], left: ObjectPattern { type: "ObjectPattern", + decorators: Array [], + optional: false, properties: Array [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "baz", + optional: false, range: [92, 95], loc: { @@ -68,15 +84,20 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: AssignmentPattern { type: "AssignmentPattern", + decorators: Array [], left: ArrayPattern { type: "ArrayPattern", + decorators: Array [], elements: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [98, 99], loc: { @@ -86,15 +107,20 @@ Program { }, AssignmentPattern { type: "AssignmentPattern", + decorators: Array [], left: ObjectPattern { type: "ObjectPattern", + decorators: Array [], + optional: false, properties: Array [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [103, 106], loc: { @@ -104,15 +130,20 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: AssignmentPattern { type: "AssignmentPattern", + decorators: Array [], left: ArrayPattern { type: "ArrayPattern", + decorators: Array [], elements: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [109, 110], loc: { @@ -121,6 +152,7 @@ Program { }, }, ], + optional: false, range: [108, 111], loc: { @@ -128,6 +160,7 @@ Program { end: { column: 35, line: 4 }, }, }, + optional: false, right: ArrayExpression { type: "ArrayExpression", elements: Array [ @@ -172,6 +205,7 @@ Program { end: { column: 43, line: 4 }, }, }, + optional: false, right: ObjectExpression { type: "ObjectExpression", properties: Array [ @@ -180,7 +214,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [124, 127], loc: { @@ -190,6 +226,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: ArrayExpression { type: "ArrayExpression", @@ -236,6 +273,7 @@ Program { }, }, ], + optional: false, range: [97, 135], loc: { @@ -243,6 +281,7 @@ Program { end: { column: 59, line: 4 }, }, }, + optional: false, right: ArrayExpression { type: "ArrayExpression", elements: Array [], @@ -275,6 +314,7 @@ Program { end: { column: 66, line: 4 }, }, }, + optional: false, right: ObjectExpression { type: "ObjectExpression", properties: Array [], @@ -307,6 +347,7 @@ Program { end: { column: 73, line: 4 }, }, }, + optional: false, right: ObjectExpression { type: "ObjectExpression", properties: Array [], @@ -348,7 +389,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [162, 165], loc: { @@ -358,6 +401,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: ObjectExpression { type: "ObjectExpression", @@ -367,7 +411,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [169, 172], loc: { @@ -377,6 +423,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: ObjectExpression { type: "ObjectExpression", @@ -386,7 +433,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "baz", + optional: false, range: [176, 179], loc: { @@ -396,6 +445,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: ArrayExpression { type: "ArrayExpression", @@ -419,7 +469,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [187, 190], loc: { @@ -429,6 +481,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: ArrayExpression { type: "ArrayExpression", diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-nested/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-nested/snapshots/5-AST-Alignment-AST.shot index 5dac5966e17..ccff1fdb997 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-nested/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-nested/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,602 @@ exports[`AST Fixtures legacy-fixtures basics destructuring-assignment-nested AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: AssignmentExpression { + type: 'AssignmentExpression', + left: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: AssignmentPattern { + type: 'AssignmentPattern', +- decorators: Array [], + left: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [85, 88], + loc: { + start: { column: 9, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: AssignmentPattern { + type: 'AssignmentPattern', +- decorators: Array [], + left: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'baz', +- optional: false, + + range: [92, 95], + loc: { + start: { column: 16, line: 4 }, + end: { column: 19, line: 4 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: AssignmentPattern { + type: 'AssignmentPattern', +- decorators: Array [], + left: ArrayPattern { + type: 'ArrayPattern', +- decorators: Array [], + elements: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [98, 99], + loc: { + start: { column: 22, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + AssignmentPattern { + type: 'AssignmentPattern', +- decorators: Array [], + left: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [103, 106], + loc: { + start: { column: 27, line: 4 }, + end: { column: 30, line: 4 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: AssignmentPattern { + type: 'AssignmentPattern', +- decorators: Array [], + left: ArrayPattern { + type: 'ArrayPattern', +- decorators: Array [], + elements: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [109, 110], + loc: { + start: { column: 33, line: 4 }, + end: { column: 34, line: 4 }, + }, + }, + ], +- optional: false, + + range: [108, 111], + loc: { + start: { column: 32, line: 4 }, + end: { column: 35, line: 4 }, + }, + }, +- optional: false, + right: ArrayExpression { + type: 'ArrayExpression', + elements: Array [ + Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [115, 116], + loc: { + start: { column: 39, line: 4 }, + end: { column: 40, line: 4 }, + }, + }, + ], + + range: [114, 117], + loc: { + start: { column: 38, line: 4 }, + end: { column: 41, line: 4 }, + }, + }, + + range: [108, 117], + loc: { + start: { column: 32, line: 4 }, + end: { column: 41, line: 4 }, + }, + }, + + range: [103, 117], + loc: { + start: { column: 27, line: 4 }, + end: { column: 41, line: 4 }, + }, + }, + ], + + range: [101, 119], + loc: { + start: { column: 25, line: 4 }, + end: { column: 43, line: 4 }, + }, + }, +- optional: false, + right: ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [124, 127], + loc: { + start: { column: 48, line: 4 }, + end: { column: 51, line: 4 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: ArrayExpression { + type: 'ArrayExpression', + elements: Array [ + Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [130, 131], + loc: { + start: { column: 54, line: 4 }, + end: { column: 55, line: 4 }, + }, + }, + ], + + range: [129, 132], + loc: { + start: { column: 53, line: 4 }, + end: { column: 56, line: 4 }, + }, + }, + + range: [124, 132], + loc: { + start: { column: 48, line: 4 }, + end: { column: 56, line: 4 }, + }, + }, + ], + + range: [122, 134], + loc: { + start: { column: 46, line: 4 }, + end: { column: 58, line: 4 }, + }, + }, + + range: [101, 134], + loc: { + start: { column: 25, line: 4 }, + end: { column: 58, line: 4 }, + }, + }, + ], +- optional: false, + + range: [97, 135], + loc: { + start: { column: 21, line: 4 }, + end: { column: 59, line: 4 }, + }, + }, +- optional: false, + right: ArrayExpression { + type: 'ArrayExpression', + elements: Array [], + + range: [138, 140], + loc: { + start: { column: 62, line: 4 }, + end: { column: 64, line: 4 }, + }, + }, + + range: [97, 140], + loc: { + start: { column: 21, line: 4 }, + end: { column: 64, line: 4 }, + }, + }, + + range: [92, 140], + loc: { + start: { column: 16, line: 4 }, + end: { column: 64, line: 4 }, + }, + }, + ], + + range: [90, 142], + loc: { + start: { column: 14, line: 4 }, + end: { column: 66, line: 4 }, + }, + }, +- optional: false, + right: ObjectExpression { + type: 'ObjectExpression', + properties: Array [], + + range: [145, 147], + loc: { + start: { column: 69, line: 4 }, + end: { column: 71, line: 4 }, + }, + }, + + range: [90, 147], + loc: { + start: { column: 14, line: 4 }, + end: { column: 71, line: 4 }, + }, + }, + + range: [85, 147], + loc: { + start: { column: 9, line: 4 }, + end: { column: 71, line: 4 }, + }, + }, + ], + + range: [83, 149], + loc: { + start: { column: 7, line: 4 }, + end: { column: 73, line: 4 }, + }, + }, +- optional: false, + right: ObjectExpression { + type: 'ObjectExpression', + properties: Array [], + + range: [152, 154], + loc: { + start: { column: 76, line: 4 }, + end: { column: 78, line: 4 }, + }, + }, + + range: [83, 154], + loc: { + start: { column: 7, line: 4 }, + end: { column: 78, line: 4 }, + }, + }, + + range: [78, 154], + loc: { + start: { column: 2, line: 4 }, + end: { column: 78, line: 4 }, + }, + }, + ], + + range: [74, 157], + loc: { + start: { column: 1, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + operator: '=', + right: ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [162, 165], + loc: { + start: { column: 6, line: 5 }, + end: { column: 9, line: 5 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [169, 172], + loc: { + start: { column: 13, line: 5 }, + end: { column: 16, line: 5 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'baz', +- optional: false, + + range: [176, 179], + loc: { + start: { column: 20, line: 5 }, + end: { column: 23, line: 5 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: ArrayExpression { + type: 'ArrayExpression', + elements: Array [ + Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [182, 183], + loc: { + start: { column: 26, line: 5 }, + end: { column: 27, line: 5 }, + }, + }, + ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [187, 190], + loc: { + start: { column: 31, line: 5 }, + end: { column: 34, line: 5 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: ArrayExpression { + type: 'ArrayExpression', + elements: Array [ + Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [193, 194], + loc: { + start: { column: 37, line: 5 }, + end: { column: 38, line: 5 }, + }, + }, + ], + + range: [192, 195], + loc: { + start: { column: 36, line: 5 }, + end: { column: 39, line: 5 }, + }, + }, + + range: [187, 195], + loc: { + start: { column: 31, line: 5 }, + end: { column: 39, line: 5 }, + }, + }, + ], + + range: [185, 197], + loc: { + start: { column: 29, line: 5 }, + end: { column: 41, line: 5 }, + }, + }, + ], + + range: [181, 198], + loc: { + start: { column: 25, line: 5 }, + end: { column: 42, line: 5 }, + }, + }, + + range: [176, 198], + loc: { + start: { column: 20, line: 5 }, + end: { column: 42, line: 5 }, + }, + }, + ], + + range: [174, 200], + loc: { + start: { column: 18, line: 5 }, + end: { column: 44, line: 5 }, + }, + }, + + range: [169, 200], + loc: { + start: { column: 13, line: 5 }, + end: { column: 44, line: 5 }, + }, + }, + ], + + range: [167, 202], + loc: { + start: { column: 11, line: 5 }, + end: { column: 46, line: 5 }, + }, + }, + + range: [162, 202], + loc: { + start: { column: 6, line: 5 }, + end: { column: 46, line: 5 }, + }, + }, + ], + + range: [160, 204], + loc: { + start: { column: 4, line: 5 }, + end: { column: 48, line: 5 }, + }, + }, + + range: [74, 204], + loc: { + start: { column: 1, line: 3 }, + end: { column: 48, line: 5 }, + }, + }, + + range: [73, 206], + loc: { + start: { column: 0, line: 3 }, + end: { column: 50, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 207], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-object/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-object/snapshots/1-TSESTree-AST.shot index 703efd77f94..47c7c1b7e36 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-object/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-object/snapshots/1-TSESTree-AST.shot @@ -10,13 +10,17 @@ Program { type: "AssignmentExpression", left: ObjectPattern { type: "ObjectPattern", + decorators: Array [], + optional: false, properties: Array [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [76, 79], loc: { @@ -26,12 +30,16 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: true, value: AssignmentPattern { type: "AssignmentPattern", + decorators: Array [], left: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [76, 79], loc: { @@ -39,6 +47,7 @@ Program { end: { column: 6, line: 3 }, }, }, + optional: false, right: ObjectExpression { type: "ObjectExpression", properties: Array [], @@ -74,7 +83,9 @@ Program { operator: "=", right: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [89, 92], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-object/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-object/snapshots/5-AST-Alignment-AST.shot index ae08e0c3a91..55963364596 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-object/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-object/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,122 @@ exports[`AST Fixtures legacy-fixtures basics destructuring-assignment-object AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: AssignmentExpression { + type: 'AssignmentExpression', + left: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [76, 79], + loc: { + start: { column: 3, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: AssignmentPattern { + type: 'AssignmentPattern', +- decorators: Array [], + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [76, 79], + loc: { + start: { column: 3, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, +- optional: false, + right: ObjectExpression { + type: 'ObjectExpression', + properties: Array [], + + range: [82, 84], + loc: { + start: { column: 9, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + + range: [76, 84], + loc: { + start: { column: 3, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + + range: [76, 84], + loc: { + start: { column: 3, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + ], + + range: [74, 86], + loc: { + start: { column: 1, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + operator: '=', + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [89, 92], + loc: { + start: { column: 16, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [74, 92], + loc: { + start: { column: 1, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 95], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-property/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-property/snapshots/1-TSESTree-AST.shot index d9ccb771cc4..c997506aeef 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-property/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-property/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 35, line: 3 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [82, 85], loc: { @@ -32,15 +35,20 @@ Program { params: Array [ AssignmentPattern { type: "AssignmentPattern", + decorators: Array [], left: ObjectPattern { type: "ObjectPattern", + decorators: Array [], + optional: false, properties: Array [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [88, 91], loc: { @@ -50,12 +58,16 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: true, value: AssignmentPattern { type: "AssignmentPattern", + decorators: Array [], left: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [88, 91], loc: { @@ -63,6 +75,7 @@ Program { end: { column: 18, line: 3 }, }, }, + optional: false, right: ArrayExpression { type: "ArrayExpression", elements: Array [], @@ -95,9 +108,12 @@ Program { end: { column: 25, line: 3 }, }, }, + optional: false, right: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [101, 104], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-property/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-property/snapshots/5-AST-Alignment-AST.shot index c4b496ef856..d79e152fe48 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-property/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment-property/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,151 @@ exports[`AST Fixtures legacy-fixtures basics destructuring-assignment-property AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [106, 108], + loc: { + start: { column: 33, line: 3 }, + end: { column: 35, line: 3 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [82, 85], + loc: { + start: { column: 9, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + params: Array [ + AssignmentPattern { + type: 'AssignmentPattern', +- decorators: Array [], + left: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: AssignmentPattern { + type: 'AssignmentPattern', +- decorators: Array [], + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, +- optional: false, + right: ArrayExpression { + type: 'ArrayExpression', + elements: Array [], + + range: [94, 96], + loc: { + start: { column: 21, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + + range: [88, 96], + loc: { + start: { column: 15, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + + range: [88, 96], + loc: { + start: { column: 15, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + ], + + range: [86, 98], + loc: { + start: { column: 13, line: 3 }, + end: { column: 25, line: 3 }, + }, + }, +- optional: false, + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [101, 104], + loc: { + start: { column: 28, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + + range: [86, 104], + loc: { + start: { column: 13, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + ], + + range: [73, 108], + loc: { + start: { column: 0, line: 3 }, + end: { column: 35, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 109], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment/snapshots/1-TSESTree-AST.shot index 7e21c0e04f1..26275153179 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment/snapshots/1-TSESTree-AST.shot @@ -10,13 +10,17 @@ Program { type: "AssignmentExpression", left: ObjectPattern { type: "ObjectPattern", + decorators: Array [], + optional: false, properties: Array [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [76, 79], loc: { @@ -26,12 +30,16 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: true, value: AssignmentPattern { type: "AssignmentPattern", + decorators: Array [], left: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [76, 79], loc: { @@ -39,6 +47,7 @@ Program { end: { column: 6, line: 3 }, }, }, + optional: false, right: ArrayExpression { type: "ArrayExpression", elements: Array [], @@ -74,7 +83,9 @@ Program { operator: "=", right: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [89, 92], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment/snapshots/5-AST-Alignment-AST.shot index 004656cc596..c3df90d7c07 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/destructuring-assignment/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,122 @@ exports[`AST Fixtures legacy-fixtures basics destructuring-assignment AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: AssignmentExpression { + type: 'AssignmentExpression', + left: ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [76, 79], + loc: { + start: { column: 3, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: AssignmentPattern { + type: 'AssignmentPattern', +- decorators: Array [], + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [76, 79], + loc: { + start: { column: 3, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, +- optional: false, + right: ArrayExpression { + type: 'ArrayExpression', + elements: Array [], + + range: [82, 84], + loc: { + start: { column: 9, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + + range: [76, 84], + loc: { + start: { column: 3, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + + range: [76, 84], + loc: { + start: { column: 3, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + ], + + range: [74, 86], + loc: { + start: { column: 1, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + operator: '=', + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [89, 92], + loc: { + start: { column: 16, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [74, 92], + loc: { + start: { column: 1, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 95], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-module/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-module/snapshots/1-TSESTree-AST.shot index 3f74d63a87e..7b55e2d0174 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-module/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-module/snapshots/1-TSESTree-AST.shot @@ -35,9 +35,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [108, 109], loc: { @@ -64,6 +67,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [104, 114], @@ -100,9 +104,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + global: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [80, 83], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-module/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-module/snapshots/5-AST-Alignment-AST.shot index 8ce2d9d2915..c75aad24395 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-module/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-module/snapshots/5-AST-Alignment-AST.shot @@ -39,9 +39,12 @@ exports[`AST Fixtures legacy-fixtures basics directive-in-module AST Alignment - declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [108, 109], loc: { @@ -68,6 +71,7 @@ exports[`AST Fixtures legacy-fixtures basics directive-in-module AST Alignment - }, }, ], +- declare: false, kind: 'var', range: [104, 114], @@ -104,9 +108,13 @@ exports[`AST Fixtures legacy-fixtures basics directive-in-module AST Alignment - end: { column: 1, line: 7 }, }, }, +- declare: false, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [80, 83], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/1-TSESTree-AST.shot index 54670d060d5..1a8c3ba3b9d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/1-TSESTree-AST.shot @@ -35,9 +35,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [111, 112], loc: { @@ -64,6 +67,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [107, 117], @@ -100,9 +104,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + global: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/5-AST-Alignment-AST.shot index 620319c6645..de4dae42b2e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/directive-in-namespace/snapshots/5-AST-Alignment-AST.shot @@ -39,9 +39,12 @@ exports[`AST Fixtures legacy-fixtures basics directive-in-namespace AST Alignmen declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [111, 112], loc: { @@ -68,6 +71,7 @@ exports[`AST Fixtures legacy-fixtures basics directive-in-namespace AST Alignmen }, }, ], +- declare: false, kind: 'var', range: [107, 117], @@ -104,9 +108,13 @@ exports[`AST Fixtures legacy-fixtures basics directive-in-namespace AST Alignmen end: { column: 1, line: 7 }, }, }, +- declare: false, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/dynamic-import-with-import-assertions/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/dynamic-import-with-import-assertions/snapshots/1-TSESTree-AST.shot index c00fcd9d0f4..3414ce8745f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/dynamic-import-with-import-assertions/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/dynamic-import-with-import-assertions/snapshots/1-TSESTree-AST.shot @@ -16,7 +16,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "assert", + optional: false, range: [89, 95], loc: { @@ -26,6 +28,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: ObjectExpression { type: "ObjectExpression", @@ -35,7 +38,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "type", + optional: false, range: [99, 103], loc: { @@ -45,6 +50,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: Literal { type: "Literal", diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/dynamic-import-with-import-assertions/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/dynamic-import-with-import-assertions/snapshots/5-AST-Alignment-AST.shot index 30c981d13d0..ffde724a507 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/dynamic-import-with-import-assertions/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/dynamic-import-with-import-assertions/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,133 @@ exports[`AST Fixtures legacy-fixtures basics dynamic-import-with-import-assertions AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ImportExpression { + type: 'ImportExpression', + attributes: ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'assert', +- optional: false, + + range: [89, 95], + loc: { + start: { column: 16, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'type', +- optional: false, + + range: [99, 103], + loc: { + start: { column: 26, line: 3 }, + end: { column: 30, line: 3 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: Literal { + type: 'Literal', + raw: '\\\\'json\\\\'', + value: 'json', + + range: [105, 111], + loc: { + start: { column: 32, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [99, 111], + loc: { + start: { column: 26, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + ], + + range: [97, 113], + loc: { + start: { column: 24, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + + range: [89, 113], + loc: { + start: { column: 16, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + ], + + range: [87, 115], + loc: { + start: { column: 14, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + source: Literal { + type: 'Literal', + raw: '\\\\'foo\\\\'', + value: 'foo', + + range: [80, 85], + loc: { + start: { column: 7, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + + range: [73, 116], + loc: { + start: { column: 0, line: 3 }, + end: { column: 43, line: 3 }, + }, + }, + + range: [73, 117], + loc: { + start: { column: 0, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 118], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-all-with-import-assertions/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-all-with-import-assertions/snapshots/1-TSESTree-AST.shot index f72725a69e3..a24244eac7a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-all-with-import-assertions/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-all-with-import-assertions/snapshots/1-TSESTree-AST.shot @@ -11,7 +11,9 @@ Program { type: "ImportAttribute", key: Identifier { type: "Identifier", + decorators: Array [], name: "type", + optional: false, range: [102, 106], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-all-with-import-assertions/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-all-with-import-assertions/snapshots/5-AST-Alignment-AST.shot index 2993c4da95d..c0ae5aef615 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-all-with-import-assertions/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-all-with-import-assertions/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,75 @@ exports[`AST Fixtures legacy-fixtures basics export-all-with-import-assertions AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportAllDeclaration { + type: 'ExportAllDeclaration', + assertions: Array [ + ImportAttribute { + type: 'ImportAttribute', + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'type', +- optional: false, + + range: [102, 106], + loc: { + start: { column: 29, line: 3 }, + end: { column: 33, line: 3 }, + }, + }, + value: Literal { + type: 'Literal', + raw: '\\\\'json\\\\'', + value: 'json', + + range: [108, 114], + loc: { + start: { column: 35, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + + range: [102, 114], + loc: { + start: { column: 29, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + ], + exported: null, + exportKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\\\'mod\\\\'', + value: 'mod', + + range: [87, 92], + loc: { + start: { column: 14, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [73, 117], + loc: { + start: { column: 0, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + ], + sourceType: 'module', + + range: [73, 118], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-as-namespace/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-as-namespace/snapshots/1-TSESTree-AST.shot index 50171dcd871..84a6d022e66 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-as-namespace/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-as-namespace/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "TSNamespaceExportDeclaration", id: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [93, 94], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-as-namespace/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-as-namespace/snapshots/5-AST-Alignment-AST.shot index aa1998499a4..7eb5256b921 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-as-namespace/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-as-namespace/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,40 @@ exports[`AST Fixtures legacy-fixtures basics export-as-namespace AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSNamespaceExportDeclaration { + type: 'TSNamespaceExportDeclaration', + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [93, 94], + loc: { + start: { column: 20, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + + range: [73, 95], + loc: { + start: { column: 0, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 96], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-assignment/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-assignment/snapshots/1-TSESTree-AST.shot index dd6b69de77e..a1de0749506 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-assignment/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-assignment/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "TSExportAssignment", expression: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [82, 85], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-assignment/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-assignment/snapshots/5-AST-Alignment-AST.shot index 06a9e4da38e..152aef092c8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-assignment/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-assignment/snapshots/5-AST-Alignment-AST.shot @@ -12,7 +12,9 @@ exports[`AST Fixtures legacy-fixtures basics export-assignment AST Alignment - A type: 'TSExportAssignment', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [82, 85], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/1-TSESTree-AST.shot index 028706dced8..1e49ea9121d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/1-TSESTree-AST.shot @@ -13,7 +13,9 @@ Program { declare: true, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [99, 102], loc: { @@ -24,9 +26,12 @@ Program { members: Array [ TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [107, 110], loc: { @@ -54,9 +59,12 @@ Program { }, TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [118, 121], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/5-AST-Alignment-AST.shot index 5dced47878b..b3b73fdb401 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-const-named-enum/snapshots/5-AST-Alignment-AST.shot @@ -17,7 +17,9 @@ exports[`AST Fixtures legacy-fixtures basics export-declare-const-named-enum AST declare: true, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [99, 102], loc: { @@ -28,9 +30,12 @@ exports[`AST Fixtures legacy-fixtures basics export-declare-const-named-enum AST members: Array [ TSEnumMember { type: 'TSEnumMember', +- computed: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [107, 110], loc: { @@ -58,9 +63,12 @@ exports[`AST Fixtures legacy-fixtures basics export-declare-const-named-enum AST }, TSEnumMember { type: 'TSEnumMember', +- computed: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [118, 121], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/1-TSESTree-AST.shot index 7818df7d526..f1fa4e0f1ff 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/1-TSESTree-AST.shot @@ -9,10 +9,13 @@ Program { assertions: Array [], declaration: TSEnumDeclaration { type: "TSEnumDeclaration", + const: false, declare: true, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [93, 96], loc: { @@ -23,9 +26,12 @@ Program { members: Array [ TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [101, 104], loc: { @@ -53,9 +59,12 @@ Program { }, TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [112, 115], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/5-AST-Alignment-AST.shot index 73d878a12ec..2d768bbf61b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-declare-named-enum/snapshots/5-AST-Alignment-AST.shot @@ -13,10 +13,13 @@ exports[`AST Fixtures legacy-fixtures basics export-declare-named-enum AST Align assertions: Array [], declaration: TSEnumDeclaration { type: 'TSEnumDeclaration', +- const: false, declare: true, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [93, 96], loc: { @@ -27,9 +30,12 @@ exports[`AST Fixtures legacy-fixtures basics export-declare-named-enum AST Align members: Array [ TSEnumMember { type: 'TSEnumMember', +- computed: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [101, 104], loc: { @@ -57,9 +63,12 @@ exports[`AST Fixtures legacy-fixtures basics export-declare-named-enum AST Align }, TSEnumMember { type: 'TSEnumMember', +- computed: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [112, 115], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-generic/snapshots/1-TSESTree-AST.shot index 26e794c23c8..6b1c9234018 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-generic/snapshots/1-TSESTree-AST.shot @@ -8,6 +8,7 @@ Program { type: "ExportDefaultDeclaration", declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -18,7 +19,10 @@ Program { end: { column: 26, line: 3 }, }, }, + declare: false, + decorators: Array [], id: null, + implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -28,7 +32,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [94, 95], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-generic/snapshots/5-AST-Alignment-AST.shot index 48fca727adc..55f15f1d18b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-generic/snapshots/5-AST-Alignment-AST.shot @@ -12,6 +12,7 @@ exports[`AST Fixtures legacy-fixtures basics export-default-class-with-generic A type: 'ExportDefaultDeclaration', declaration: ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -22,7 +23,10 @@ exports[`AST Fixtures legacy-fixtures basics export-default-class-with-generic A end: { column: 26, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: null, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -32,7 +36,9 @@ exports[`AST Fixtures legacy-fixtures basics export-default-class-with-generic A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [94, 95], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-multiple-generics/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-multiple-generics/snapshots/1-TSESTree-AST.shot index 6f105eb8e62..2812c329dee 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-multiple-generics/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-multiple-generics/snapshots/1-TSESTree-AST.shot @@ -8,6 +8,7 @@ Program { type: "ExportDefaultDeclaration", declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -18,7 +19,10 @@ Program { end: { column: 29, line: 3 }, }, }, + declare: false, + decorators: Array [], id: null, + implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -28,7 +32,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [94, 95], loc: { @@ -49,7 +55,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [97, 98], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-multiple-generics/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-multiple-generics/snapshots/5-AST-Alignment-AST.shot index 4ffda7290af..f5dc8e055f2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-multiple-generics/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-class-with-multiple-generics/snapshots/5-AST-Alignment-AST.shot @@ -12,6 +12,7 @@ exports[`AST Fixtures legacy-fixtures basics export-default-class-with-multiple- type: 'ExportDefaultDeclaration', declaration: ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -22,7 +23,10 @@ exports[`AST Fixtures legacy-fixtures basics export-default-class-with-multiple- end: { column: 29, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: null, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -32,7 +36,9 @@ exports[`AST Fixtures legacy-fixtures basics export-default-class-with-multiple- - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [94, 95], - loc: { @@ -54,7 +60,9 @@ exports[`AST Fixtures legacy-fixtures basics export-default-class-with-multiple- - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [97, 98], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-interface/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-interface/snapshots/1-TSESTree-AST.shot index 00d14443f68..24273fb56b7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-interface/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-interface/snapshots/1-TSESTree-AST.shot @@ -16,7 +16,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "method1", + optional: false, range: [104, 111], loc: { @@ -25,7 +27,9 @@ Program { }, }, kind: "method", + optional: false, params: Array [], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSVoidKeyword { @@ -44,6 +48,7 @@ Program { end: { column: 17, line: 4 }, }, }, + static: false, range: [104, 120], loc: { @@ -59,9 +64,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [98, 99], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-interface/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-interface/snapshots/5-AST-Alignment-AST.shot index 201605ce2b5..28434626438 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-interface/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-default-interface/snapshots/5-AST-Alignment-AST.shot @@ -20,7 +20,9 @@ exports[`AST Fixtures legacy-fixtures basics export-default-interface AST Alignm computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'method1', +- optional: false, range: [104, 111], loc: { @@ -29,7 +31,9 @@ exports[`AST Fixtures legacy-fixtures basics export-default-interface AST Alignm }, }, kind: 'method', +- optional: false, - params: Array [], +- readonly: false, - returnType: TSTypeAnnotation { + parameters: Array [], + typeAnnotation: TSTypeAnnotation { @@ -50,6 +54,7 @@ exports[`AST Fixtures legacy-fixtures basics export-default-interface AST Alignm end: { column: 17, line: 4 }, }, }, +- static: false, range: [104, 120], loc: { @@ -65,9 +70,13 @@ exports[`AST Fixtures legacy-fixtures basics export-default-interface AST Alignm end: { column: 1, line: 5 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [98, 99], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-generic/snapshots/1-TSESTree-AST.shot index 4a03c5671eb..6c88436eb03 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-generic/snapshots/1-TSESTree-AST.shot @@ -9,6 +9,7 @@ Program { assertions: Array [], declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -19,9 +20,13 @@ Program { end: { column: 22, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [86, 89], loc: { @@ -29,6 +34,7 @@ Program { end: { column: 16, line: 3 }, }, }, + implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -38,7 +44,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [90, 91], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-generic/snapshots/5-AST-Alignment-AST.shot index c1c8ef30217..95660dabb1f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-generic/snapshots/5-AST-Alignment-AST.shot @@ -13,6 +13,7 @@ exports[`AST Fixtures legacy-fixtures basics export-named-class-with-generic AST assertions: Array [], declaration: ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -23,9 +24,13 @@ exports[`AST Fixtures legacy-fixtures basics export-named-class-with-generic AST end: { column: 22, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [86, 89], loc: { @@ -33,6 +38,7 @@ exports[`AST Fixtures legacy-fixtures basics export-named-class-with-generic AST end: { column: 16, line: 3 }, }, }, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -42,7 +48,9 @@ exports[`AST Fixtures legacy-fixtures basics export-named-class-with-generic AST - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [90, 91], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-multiple-generics/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-multiple-generics/snapshots/1-TSESTree-AST.shot index 5f1bbd5e181..c5a865c2b5c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-multiple-generics/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-multiple-generics/snapshots/1-TSESTree-AST.shot @@ -9,6 +9,7 @@ Program { assertions: Array [], declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -19,9 +20,13 @@ Program { end: { column: 25, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [86, 89], loc: { @@ -29,6 +34,7 @@ Program { end: { column: 16, line: 3 }, }, }, + implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", @@ -38,7 +44,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [90, 91], loc: { @@ -59,7 +67,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [93, 94], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-multiple-generics/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-multiple-generics/snapshots/5-AST-Alignment-AST.shot index dd222440483..6279dcd6d65 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-multiple-generics/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-class-with-multiple-generics/snapshots/5-AST-Alignment-AST.shot @@ -13,6 +13,7 @@ exports[`AST Fixtures legacy-fixtures basics export-named-class-with-multiple-ge assertions: Array [], declaration: ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -23,9 +24,13 @@ exports[`AST Fixtures legacy-fixtures basics export-named-class-with-multiple-ge end: { column: 25, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [86, 89], loc: { @@ -33,6 +38,7 @@ exports[`AST Fixtures legacy-fixtures basics export-named-class-with-multiple-ge end: { column: 16, line: 3 }, }, }, +- implements: Array [], superClass: null, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', @@ -42,7 +48,9 @@ exports[`AST Fixtures legacy-fixtures basics export-named-class-with-multiple-ge - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [90, 91], - loc: { @@ -64,7 +72,9 @@ exports[`AST Fixtures legacy-fixtures basics export-named-class-with-multiple-ge - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [93, 94], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/1-TSESTree-AST.shot index da531568f5d..dfc22d79e93 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,13 @@ Program { assertions: Array [], declaration: TSEnumDeclaration { type: "TSEnumDeclaration", + const: false, + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [85, 88], loc: { @@ -22,9 +26,12 @@ Program { members: Array [ TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [93, 96], loc: { @@ -52,9 +59,12 @@ Program { }, TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [104, 107], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/5-AST-Alignment-AST.shot index 596d7bfe356..1471fe30127 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-named-enum/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,112 @@ exports[`AST Fixtures legacy-fixtures basics export-named-enum AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + assertions: Array [], + declaration: TSEnumDeclaration { + type: 'TSEnumDeclaration', +- const: false, +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [85, 88], + loc: { + start: { column: 12, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + members: Array [ + TSEnumMember { + type: 'TSEnumMember', +- computed: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [93, 96], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + initializer: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [99, 100], + loc: { + start: { column: 8, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + + range: [93, 100], + loc: { + start: { column: 2, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + TSEnumMember { + type: 'TSEnumMember', +- computed: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [104, 107], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + + range: [104, 107], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + ], + + range: [80, 110], + loc: { + start: { column: 7, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, + exportKind: 'value', + source: null, + specifiers: Array [], + + range: [73, 110], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, + ], + sourceType: 'module', + + range: [73, 111], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 7 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-star-as-ns-from/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-star-as-ns-from/snapshots/1-TSESTree-AST.shot index d143f1445f5..8b8ad2d4bb9 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-star-as-ns-from/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-star-as-ns-from/snapshots/1-TSESTree-AST.shot @@ -9,7 +9,9 @@ Program { assertions: Array [], exported: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [85, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-star-as-ns-from/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-star-as-ns-from/snapshots/5-AST-Alignment-AST.shot index b102f45164b..e67a3716c40 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-star-as-ns-from/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-star-as-ns-from/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,53 @@ exports[`AST Fixtures legacy-fixtures basics export-star-as-ns-from AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportAllDeclaration { + type: 'ExportAllDeclaration', + assertions: Array [], + exported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [85, 88], + loc: { + start: { column: 12, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + exportKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\\\'bar\\\\'', + value: 'bar', + + range: [94, 99], + loc: { + start: { column: 21, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + + range: [73, 100], + loc: { + start: { column: 0, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + ], + sourceType: 'module', + + range: [73, 101], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-as/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-as/snapshots/1-TSESTree-AST.shot index c8aa3283135..13f25372be2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-as/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-as/snapshots/1-TSESTree-AST.shot @@ -15,7 +15,9 @@ Program { type: "ExportSpecifier", exported: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [92, 93], loc: { @@ -26,7 +28,9 @@ Program { exportKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [87, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-as/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-as/snapshots/5-AST-Alignment-AST.shot index 8526243ea23..c9dea6f3214 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-as/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-as/snapshots/5-AST-Alignment-AST.shot @@ -19,7 +19,9 @@ exports[`AST Fixtures legacy-fixtures basics export-type-as AST Alignment - AST type: 'ExportSpecifier', exported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [92, 93], loc: { @@ -30,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics export-type-as AST Alignment - AST exportKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [87, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from-as/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from-as/snapshots/1-TSESTree-AST.shot index 6506bdb7394..feccded46e7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from-as/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from-as/snapshots/1-TSESTree-AST.shot @@ -25,7 +25,9 @@ Program { type: "ExportSpecifier", exported: Identifier { type: "Identifier", + decorators: Array [], name: "C", + optional: false, range: [92, 93], loc: { @@ -36,7 +38,9 @@ Program { exportKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [87, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from-as/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from-as/snapshots/5-AST-Alignment-AST.shot index 0a372b10d34..8c24cfbfd3d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from-as/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from-as/snapshots/5-AST-Alignment-AST.shot @@ -29,7 +29,9 @@ exports[`AST Fixtures legacy-fixtures basics export-type-from-as AST Alignment - type: 'ExportSpecifier', exported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [92, 93], loc: { @@ -40,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures basics export-type-from-as AST Alignment - exportKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [87, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from/snapshots/1-TSESTree-AST.shot index 21c711a4a47..4df4d1cff0d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from/snapshots/1-TSESTree-AST.shot @@ -25,7 +25,9 @@ Program { type: "ExportSpecifier", exported: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [87, 90], loc: { @@ -36,7 +38,9 @@ Program { exportKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [87, 90], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from/snapshots/5-AST-Alignment-AST.shot index fa87bc4af22..051b2c234f1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type-from/snapshots/5-AST-Alignment-AST.shot @@ -29,7 +29,9 @@ exports[`AST Fixtures legacy-fixtures basics export-type-from AST Alignment - AS type: 'ExportSpecifier', exported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [87, 90], loc: { @@ -40,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures basics export-type-from AST Alignment - AS exportKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [87, 90], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type/snapshots/1-TSESTree-AST.shot index 328c854b9b6..6c8d96e91a8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type/snapshots/1-TSESTree-AST.shot @@ -15,7 +15,9 @@ Program { type: "ExportSpecifier", exported: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [87, 90], loc: { @@ -26,7 +28,9 @@ Program { exportKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [87, 90], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type/snapshots/5-AST-Alignment-AST.shot index dca27176e25..b34ddb187f6 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/export-type/snapshots/5-AST-Alignment-AST.shot @@ -19,7 +19,9 @@ exports[`AST Fixtures legacy-fixtures basics export-type AST Alignment - AST 1`] type: 'ExportSpecifier', exported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [87, 90], loc: { @@ -30,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics export-type AST Alignment - AST 1`] exportKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [87, 90], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anonymus-with-type-parameters/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anonymus-with-type-parameters/snapshots/1-TSESTree-AST.shot index 7b536d258a7..7f299396cef 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anonymus-with-type-parameters/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anonymus-with-type-parameters/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "obj", + optional: false, range: [77, 80], loc: { @@ -29,7 +32,9 @@ Program { type: "ReturnStatement", argument: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [118, 119], loc: { @@ -52,13 +57,16 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -93,7 +101,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [93, 94], loc: { @@ -132,6 +142,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [73, 123], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anonymus-with-type-parameters/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anonymus-with-type-parameters/snapshots/5-AST-Alignment-AST.shot index a35e030838b..37b74948f0f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anonymus-with-type-parameters/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anonymus-with-type-parameters/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures basics function-anonymus-with-type-paramet declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'obj', +- optional: false, range: [77, 80], loc: { @@ -33,7 +36,9 @@ exports[`AST Fixtures legacy-fixtures basics function-anonymus-with-type-paramet type: 'ReturnStatement', argument: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [118, 119], loc: { @@ -56,13 +61,16 @@ exports[`AST Fixtures legacy-fixtures basics function-anonymus-with-type-paramet end: { column: 1, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -97,8 +105,11 @@ exports[`AST Fixtures legacy-fixtures basics function-anonymus-with-type-paramet - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', -- +- optional: false, ++ name: 'T', + - range: [93, 94], - loc: { - start: { column: 20, line: 3 }, @@ -106,8 +117,7 @@ exports[`AST Fixtures legacy-fixtures basics function-anonymus-with-type-paramet - }, - }, - out: false, -+ name: 'T', - +- range: [93, 94], loc: { start: { column: 20, line: 3 }, @@ -137,6 +147,7 @@ exports[`AST Fixtures legacy-fixtures basics function-anonymus-with-type-paramet }, }, ], +- declare: false, kind: 'var', range: [73, 123], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anynomus-with-return-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anynomus-with-return-type/snapshots/1-TSESTree-AST.shot index 353f50fad20..b7d35314440 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anynomus-with-return-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anynomus-with-return-type/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "obj", + optional: false, range: [77, 80], loc: { @@ -32,6 +35,7 @@ Program { end: { column: 30, line: 3 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -69,6 +73,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [73, 104], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anynomus-with-return-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anynomus-with-return-type/snapshots/5-AST-Alignment-AST.shot index 9fe3b48e456..98998cbaa44 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anynomus-with-return-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-anynomus-with-return-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,97 @@ exports[`AST Fixtures legacy-fixtures basics function-anynomus-with-return-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'obj', +- optional: false, + + range: [77, 80], + loc: { + start: { column: 4, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + init: FunctionExpression { + type: 'FunctionExpression', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [101, 103], + loc: { + start: { column: 28, line: 3 }, + end: { column: 30, line: 3 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: null, + params: Array [], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSVoidKeyword { + type: 'TSVoidKeyword', + + range: [96, 100], + loc: { + start: { column: 23, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + + range: [94, 100], + loc: { + start: { column: 21, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + + range: [83, 103], + loc: { + start: { column: 10, line: 3 }, + end: { column: 30, line: 3 }, + }, + }, + + range: [77, 103], + loc: { + start: { column: 4, line: 3 }, + end: { column: 30, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [73, 104], + loc: { + start: { column: 0, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 105], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-overloads/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-overloads/snapshots/1-TSESTree-AST.shot index 49eeab15482..ff86b83b759 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-overloads/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-overloads/snapshots/1-TSESTree-AST.shot @@ -10,11 +10,14 @@ Program { declaration: TSDeclareFunction { type: "TSDeclareFunction", async: false, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "f", + optional: false, range: [89, 90], loc: { @@ -25,7 +28,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -93,11 +98,14 @@ Program { declaration: TSDeclareFunction { type: "TSDeclareFunction", async: false, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "f", + optional: false, range: [127, 128], loc: { @@ -108,7 +116,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -183,7 +193,9 @@ Program { type: "ReturnStatement", argument: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [215, 216], loc: { @@ -206,11 +218,14 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "f", + optional: false, range: [165, 166], loc: { @@ -221,7 +236,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnionType { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-overloads/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-overloads/snapshots/5-AST-Alignment-AST.shot index 76b94490a41..4af306c530c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-overloads/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-overloads/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,355 @@ exports[`AST Fixtures legacy-fixtures basics function-overloads AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + assertions: Array [], + declaration: TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'f', +- optional: false, + + range: [89, 90], + loc: { + start: { column: 16, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [94, 100], + loc: { + start: { column: 21, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + + range: [92, 100], + loc: { + start: { column: 19, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + + range: [91, 100], + loc: { + start: { column: 18, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [103, 109], + loc: { + start: { column: 30, line: 3 }, + end: { column: 36, line: 3 }, + }, + }, + + range: [101, 109], + loc: { + start: { column: 28, line: 3 }, + end: { column: 36, line: 3 }, + }, + }, + + range: [80, 110], + loc: { + start: { column: 7, line: 3 }, + end: { column: 37, line: 3 }, + }, + }, + exportKind: 'value', + source: null, + specifiers: Array [], + + range: [73, 110], + loc: { + start: { column: 0, line: 3 }, + end: { column: 37, line: 3 }, + }, + }, + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + assertions: Array [], + declaration: TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'f', +- optional: false, + + range: [127, 128], + loc: { + start: { column: 16, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [132, 138], + loc: { + start: { column: 21, line: 4 }, + end: { column: 27, line: 4 }, + }, + }, + + range: [130, 138], + loc: { + start: { column: 19, line: 4 }, + end: { column: 27, line: 4 }, + }, + }, + + range: [129, 138], + loc: { + start: { column: 18, line: 4 }, + end: { column: 27, line: 4 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [141, 147], + loc: { + start: { column: 30, line: 4 }, + end: { column: 36, line: 4 }, + }, + }, + + range: [139, 147], + loc: { + start: { column: 28, line: 4 }, + end: { column: 36, line: 4 }, + }, + }, + + range: [118, 148], + loc: { + start: { column: 7, line: 4 }, + end: { column: 37, line: 4 }, + }, + }, + exportKind: 'value', + source: null, + specifiers: Array [], + + range: [111, 148], + loc: { + start: { column: 0, line: 4 }, + end: { column: 37, line: 4 }, + }, + }, + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + assertions: Array [], + declaration: FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ReturnStatement { + type: 'ReturnStatement', + argument: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [215, 216], + loc: { + start: { column: 9, line: 6 }, + end: { column: 10, line: 6 }, + }, + }, + + range: [208, 217], + loc: { + start: { column: 2, line: 6 }, + end: { column: 11, line: 6 }, + }, + }, + ], + + range: [204, 219], + loc: { + start: { column: 55, line: 5 }, + end: { column: 1, line: 7 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'f', +- optional: false, + + range: [165, 166], + loc: { + start: { column: 16, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSUnionType { + type: 'TSUnionType', + types: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [170, 176], + loc: { + start: { column: 21, line: 5 }, + end: { column: 27, line: 5 }, + }, + }, + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [179, 185], + loc: { + start: { column: 30, line: 5 }, + end: { column: 36, line: 5 }, + }, + }, + ], + + range: [170, 185], + loc: { + start: { column: 21, line: 5 }, + end: { column: 36, line: 5 }, + }, + }, + + range: [168, 185], + loc: { + start: { column: 19, line: 5 }, + end: { column: 36, line: 5 }, + }, + }, + + range: [167, 185], + loc: { + start: { column: 18, line: 5 }, + end: { column: 36, line: 5 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSUnionType { + type: 'TSUnionType', + types: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [188, 194], + loc: { + start: { column: 39, line: 5 }, + end: { column: 45, line: 5 }, + }, + }, + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [197, 203], + loc: { + start: { column: 48, line: 5 }, + end: { column: 54, line: 5 }, + }, + }, + ], + + range: [188, 203], + loc: { + start: { column: 39, line: 5 }, + end: { column: 54, line: 5 }, + }, + }, + + range: [186, 203], + loc: { + start: { column: 37, line: 5 }, + end: { column: 54, line: 5 }, + }, + }, + + range: [156, 219], + loc: { + start: { column: 7, line: 5 }, + end: { column: 1, line: 7 }, + }, + }, + exportKind: 'value', + source: null, + specifiers: Array [], + + range: [149, 219], + loc: { + start: { column: 0, line: 5 }, + end: { column: 1, line: 7 }, + }, + }, + ], + sourceType: 'module', + + range: [73, 220], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 8 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-await/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-await/snapshots/1-TSESTree-AST.shot index 124b6fd12f2..2afe4cfe111 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-await/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-await/snapshots/1-TSESTree-AST.shot @@ -16,7 +16,9 @@ Program { type: "AwaitExpression", argument: Identifier { type: "Identifier", + decorators: Array [], name: "future", + optional: false, range: [111, 117], loc: { @@ -46,11 +48,14 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "hope", + optional: false, range: [88, 92], loc: { @@ -61,7 +66,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "future", + optional: false, range: [93, 99], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-await/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-await/snapshots/5-AST-Alignment-AST.shot index 101a3738026..bb4bbd0d6a1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-await/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-await/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,99 @@ exports[`AST Fixtures legacy-fixtures basics function-with-await AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: true, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: AwaitExpression { + type: 'AwaitExpression', + argument: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'future', +- optional: false, + + range: [111, 117], + loc: { + start: { column: 8, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + + range: [105, 117], + loc: { + start: { column: 2, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + + range: [105, 118], + loc: { + start: { column: 2, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + ], + + range: [101, 120], + loc: { + start: { column: 28, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'hope', +- optional: false, + + range: [88, 92], + loc: { + start: { column: 15, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'future', +- optional: false, + + range: [93, 99], + loc: { + start: { column: 20, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + ], + + range: [73, 120], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 121], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-with-optional-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-with-optional-properties/snapshots/1-TSESTree-AST.shot index 2cab080bac2..54e4703438e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-with-optional-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-with-optional-properties/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 53, line: 3 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [82, 85], loc: { @@ -32,13 +35,17 @@ Program { params: Array [ ObjectPattern { type: "ObjectPattern", + decorators: Array [], + optional: false, properties: Array [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [88, 91], loc: { @@ -48,10 +55,13 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: true, value: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [88, 91], loc: { @@ -71,7 +81,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "baz", + optional: false, range: [93, 96], loc: { @@ -81,10 +93,13 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: true, value: Identifier { type: "Identifier", + decorators: Array [], name: "baz", + optional: false, range: [93, 96], loc: { @@ -110,7 +125,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [102, 105], loc: { @@ -119,6 +136,8 @@ Program { }, }, optional: true, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -149,7 +168,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "baz", + optional: false, range: [116, 119], loc: { @@ -158,6 +179,8 @@ Program { }, }, optional: true, + readonly: false, + static: false, range: [116, 120], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-with-optional-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-with-optional-properties/snapshots/5-AST-Alignment-AST.shot index d8a406bb7e9..9403dbbd2a9 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-with-optional-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-with-optional-properties/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,233 @@ exports[`AST Fixtures legacy-fixtures basics function-with-object-type-with-optional-properties AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [124, 126], + loc: { + start: { column: 51, line: 3 }, + end: { column: 53, line: 3 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [82, 85], + loc: { + start: { column: 9, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + params: Array [ + ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'baz', +- optional: false, + + range: [93, 96], + loc: { + start: { column: 20, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'baz', +- optional: false, + + range: [93, 96], + loc: { + start: { column: 20, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + + range: [93, 96], + loc: { + start: { column: 20, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeLiteral { + type: 'TSTypeLiteral', + members: Array [ + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [102, 105], + loc: { + start: { column: 29, line: 3 }, + end: { column: 32, line: 3 }, + }, + }, + optional: true, +- readonly: false, +- static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [108, 114], + loc: { + start: { column: 35, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + + range: [106, 114], + loc: { + start: { column: 33, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + + range: [102, 115], + loc: { + start: { column: 29, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'baz', +- optional: false, + + range: [116, 119], + loc: { + start: { column: 43, line: 3 }, + end: { column: 46, line: 3 }, + }, + }, + optional: true, +- readonly: false, +- static: false, + + range: [116, 120], + loc: { + start: { column: 43, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + ], + + range: [100, 122], + loc: { + start: { column: 27, line: 3 }, + end: { column: 49, line: 3 }, + }, + }, + + range: [98, 122], + loc: { + start: { column: 25, line: 3 }, + end: { column: 49, line: 3 }, + }, + }, + + range: [86, 122], + loc: { + start: { column: 13, line: 3 }, + end: { column: 49, line: 3 }, + }, + }, + ], + + range: [73, 126], + loc: { + start: { column: 0, line: 3 }, + end: { column: 53, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 127], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-without-annotation/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-without-annotation/snapshots/1-TSESTree-AST.shot index 88185f9b863..0f1b9f770a6 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-without-annotation/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-without-annotation/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 51, line: 3 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [82, 85], loc: { @@ -32,13 +35,17 @@ Program { params: Array [ ObjectPattern { type: "ObjectPattern", + decorators: Array [], + optional: false, properties: Array [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [88, 91], loc: { @@ -48,10 +55,13 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: true, value: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [88, 91], loc: { @@ -71,7 +81,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "baz", + optional: false, range: [93, 96], loc: { @@ -81,10 +93,13 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: true, value: Identifier { type: "Identifier", + decorators: Array [], name: "baz", + optional: false, range: [93, 96], loc: { @@ -110,7 +125,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [102, 105], loc: { @@ -118,6 +135,9 @@ Program { end: { column: 32, line: 3 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -148,7 +168,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "baz", + optional: false, range: [115, 118], loc: { @@ -156,6 +178,9 @@ Program { end: { column: 45, line: 3 }, }, }, + optional: false, + readonly: false, + static: false, range: [115, 118], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-without-annotation/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-without-annotation/snapshots/5-AST-Alignment-AST.shot index 3f1b0bd4bc4..71841138211 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-without-annotation/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-object-type-without-annotation/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,233 @@ exports[`AST Fixtures legacy-fixtures basics function-with-object-type-without-annotation AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [122, 124], + loc: { + start: { column: 49, line: 3 }, + end: { column: 51, line: 3 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [82, 85], + loc: { + start: { column: 9, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + params: Array [ + ObjectPattern { + type: 'ObjectPattern', +- decorators: Array [], +- optional: false, + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'baz', +- optional: false, + + range: [93, 96], + loc: { + start: { column: 20, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: true, + value: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'baz', +- optional: false, + + range: [93, 96], + loc: { + start: { column: 20, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + + range: [93, 96], + loc: { + start: { column: 20, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + ], + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeLiteral { + type: 'TSTypeLiteral', + members: Array [ + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [102, 105], + loc: { + start: { column: 29, line: 3 }, + end: { column: 32, line: 3 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [107, 113], + loc: { + start: { column: 34, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + + range: [105, 113], + loc: { + start: { column: 32, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + + range: [102, 114], + loc: { + start: { column: 29, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'baz', +- optional: false, + + range: [115, 118], + loc: { + start: { column: 42, line: 3 }, + end: { column: 45, line: 3 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + + range: [115, 118], + loc: { + start: { column: 42, line: 3 }, + end: { column: 45, line: 3 }, + }, + }, + ], + + range: [100, 120], + loc: { + start: { column: 27, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + + range: [98, 120], + loc: { + start: { column: 25, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + + range: [86, 120], + loc: { + start: { column: 13, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + ], + + range: [73, 124], + loc: { + start: { column: 0, line: 3 }, + end: { column: 51, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 125], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-that-have-comments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-that-have-comments/snapshots/1-TSESTree-AST.shot index 6a8770bed94..237ade59614 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-that-have-comments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-that-have-comments/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 36, line: 3 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "compare", + optional: false, range: [82, 89], loc: { @@ -38,7 +41,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [102, 103], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-that-have-comments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-that-have-comments/snapshots/5-AST-Alignment-AST.shot index 99cb440a924..5974f691189 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-that-have-comments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-that-have-comments/snapshots/5-AST-Alignment-AST.shot @@ -21,11 +21,14 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters-that- end: { column: 36, line: 3 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'compare', +- optional: false, range: [82, 89], loc: { @@ -42,7 +45,9 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters-that- - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [102, 103], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-with-constraint/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-with-constraint/snapshots/1-TSESTree-AST.shot index e2c552e2e1f..5636bf9f4b5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-with-constraint/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-with-constraint/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { type: "ReturnStatement", argument: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [118, 119], loc: { @@ -37,11 +39,14 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [82, 83], loc: { @@ -52,14 +57,18 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "X", + optional: false, range: [101, 102], loc: { @@ -95,7 +104,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "X", + optional: false, range: [105, 106], loc: { @@ -135,7 +146,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "X", + optional: false, range: [84, 85], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-with-constraint/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-with-constraint/snapshots/5-AST-Alignment-AST.shot index 16c2ff77580..9637581a613 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-with-constraint/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters-with-constraint/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters-with- type: 'ReturnStatement', argument: Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [118, 119], loc: { @@ -41,11 +43,14 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters-with- end: { column: 1, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [82, 83], loc: { @@ -56,14 +61,18 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters-with- params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [101, 102], loc: { @@ -99,7 +108,9 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters-with- type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [105, 106], loc: { @@ -139,7 +150,9 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters-with- - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'X', +- optional: false, - - range: [84, 85], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters/snapshots/1-TSESTree-AST.shot index 4ce1b21c01c..2c42f740f80 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { type: "ReturnStatement", argument: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [107, 108], loc: { @@ -37,11 +39,14 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [82, 83], loc: { @@ -52,14 +57,18 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "X", + optional: false, range: [90, 91], loc: { @@ -95,7 +104,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "X", + optional: false, range: [94, 95], loc: { @@ -125,7 +136,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "X", + optional: false, range: [84, 85], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters/snapshots/5-AST-Alignment-AST.shot index d191fba20dc..7f0653239ab 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-type-parameters/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters AST A type: 'ReturnStatement', argument: Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [107, 108], loc: { @@ -41,11 +43,14 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters AST A end: { column: 1, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [82, 83], loc: { @@ -56,14 +61,18 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters AST A params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [90, 91], loc: { @@ -99,7 +108,9 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters AST A type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [94, 95], loc: { @@ -129,7 +140,9 @@ exports[`AST Fixtures legacy-fixtures basics function-with-type-parameters AST A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'X', +- optional: false, - - range: [84, 85], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/1-TSESTree-AST.shot index 22ea837ae55..42e5421559b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { type: "ReturnStatement", argument: Identifier { type: "Identifier", + decorators: Array [], name: "name", + optional: false, range: [174, 178], loc: { @@ -37,11 +39,14 @@ Program { end: { column: 1, line: 9 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "message", + optional: false, range: [82, 89], loc: { @@ -52,7 +57,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "name", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -80,9 +87,12 @@ Program { }, AssignmentPattern { type: "AssignmentPattern", + decorators: Array [], left: Identifier { type: "Identifier", + decorators: Array [], name: "age", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -108,6 +118,7 @@ Program { end: { column: 13, line: 5 }, }, }, + optional: false, right: Literal { type: "Literal", raw: "100", @@ -130,7 +141,9 @@ Program { type: "RestElement", argument: Identifier { type: "Identifier", + decorators: Array [], name: "args", + optional: false, range: [133, 137], loc: { @@ -138,6 +151,8 @@ Program { end: { column: 9, line: 6 }, }, }, + decorators: Array [], + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { @@ -164,7 +179,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Array", + optional: false, range: [139, 144], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/5-AST-Alignment-AST.shot index 543bea7d175..8b23e6f92c7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types-assignation/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics function-with-types-assignation AST type: 'ReturnStatement', argument: Identifier { type: 'Identifier', +- decorators: Array [], name: 'name', +- optional: false, range: [174, 178], loc: { @@ -41,11 +43,14 @@ exports[`AST Fixtures legacy-fixtures basics function-with-types-assignation AST end: { column: 1, line: 9 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'message', +- optional: false, range: [82, 89], loc: { @@ -56,7 +61,9 @@ exports[`AST Fixtures legacy-fixtures basics function-with-types-assignation AST params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'name', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -84,9 +91,12 @@ exports[`AST Fixtures legacy-fixtures basics function-with-types-assignation AST }, AssignmentPattern { type: 'AssignmentPattern', +- decorators: Array [], left: Identifier { type: 'Identifier', +- decorators: Array [], name: 'age', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -112,6 +122,7 @@ exports[`AST Fixtures legacy-fixtures basics function-with-types-assignation AST end: { column: 13, line: 5 }, }, }, +- optional: false, right: Literal { type: 'Literal', raw: '100', @@ -134,7 +145,9 @@ exports[`AST Fixtures legacy-fixtures basics function-with-types-assignation AST type: 'RestElement', argument: Identifier { type: 'Identifier', +- decorators: Array [], name: 'args', +- optional: false, range: [133, 137], loc: { @@ -142,6 +155,8 @@ exports[`AST Fixtures legacy-fixtures basics function-with-types-assignation AST end: { column: 9, line: 6 }, }, }, +- decorators: Array [], +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { @@ -168,7 +183,9 @@ exports[`AST Fixtures legacy-fixtures basics function-with-types-assignation AST - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Array', +- optional: false, range: [139, 144], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types/snapshots/1-TSESTree-AST.shot index b71cf6088f7..bf4b182871f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { type: "ReturnStatement", argument: Identifier { type: "Identifier", + decorators: Array [], name: "name", + optional: false, range: [123, 127], loc: { @@ -37,11 +39,14 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "message", + optional: false, range: [82, 89], loc: { @@ -52,7 +57,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "name", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types/snapshots/5-AST-Alignment-AST.shot index 9de6b201868..590df108c3b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/function-with-types/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,126 @@ exports[`AST Fixtures legacy-fixtures basics function-with-types AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ReturnStatement { + type: 'ReturnStatement', + argument: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'name', +- optional: false, + + range: [123, 127], + loc: { + start: { column: 9, line: 4 }, + end: { column: 13, line: 4 }, + }, + }, + + range: [116, 128], + loc: { + start: { column: 2, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + ], + + range: [112, 130], + loc: { + start: { column: 39, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'message', +- optional: false, + + range: [82, 89], + loc: { + start: { column: 9, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'name', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [96, 102], + loc: { + start: { column: 23, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + + range: [94, 102], + loc: { + start: { column: 21, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + + range: [90, 102], + loc: { + start: { column: 17, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [105, 111], + loc: { + start: { column: 32, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [103, 111], + loc: { + start: { column: 30, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [73, 130], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 131], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/global-this/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/global-this/snapshots/1-TSESTree-AST.shot index 3cc967864b2..ef47b5a1e13 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/global-this/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/global-this/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "abc", + optional: false, range: [99, 102], loc: { @@ -38,6 +41,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [95, 109], @@ -55,7 +59,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "globalThis", + optional: false, range: [142, 152], loc: { @@ -66,7 +72,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "abc", + optional: false, range: [153, 156], loc: { @@ -112,9 +120,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "answer", + optional: false, range: [169, 175], loc: { @@ -141,6 +152,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [165, 181], @@ -158,7 +170,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "globalThis", + optional: false, range: [250, 260], loc: { @@ -169,7 +183,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "answer", + optional: false, range: [261, 267], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/global-this/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/global-this/snapshots/5-AST-Alignment-AST.shot index cb8e3363dc5..30ab32a0a4f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/global-this/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/global-this/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,241 @@ exports[`AST Fixtures legacy-fixtures basics global-this AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'abc', +- optional: false, + + range: [99, 102], + loc: { + start: { column: 4, line: 5 }, + end: { column: 7, line: 5 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '100', + value: 100, + + range: [105, 108], + loc: { + start: { column: 10, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, + + range: [99, 108], + loc: { + start: { column: 4, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [95, 109], + loc: { + start: { column: 0, line: 5 }, + end: { column: 14, line: 5 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: AssignmentExpression { + type: 'AssignmentExpression', + left: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'globalThis', +- optional: false, + + range: [142, 152], + loc: { + start: { column: 0, line: 8 }, + end: { column: 10, line: 8 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'abc', +- optional: false, + + range: [153, 156], + loc: { + start: { column: 11, line: 8 }, + end: { column: 14, line: 8 }, + }, + }, + + range: [142, 156], + loc: { + start: { column: 0, line: 8 }, + end: { column: 14, line: 8 }, + }, + }, + operator: '=', + right: Literal { + type: 'Literal', + raw: '200', + value: 200, + + range: [159, 162], + loc: { + start: { column: 17, line: 8 }, + end: { column: 20, line: 8 }, + }, + }, + + range: [142, 162], + loc: { + start: { column: 0, line: 8 }, + end: { column: 20, line: 8 }, + }, + }, + + range: [142, 163], + loc: { + start: { column: 0, line: 8 }, + end: { column: 21, line: 8 }, + }, + }, + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'answer', +- optional: false, + + range: [169, 175], + loc: { + start: { column: 4, line: 10 }, + end: { column: 10, line: 10 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '42', + value: 42, + + range: [178, 180], + loc: { + start: { column: 13, line: 10 }, + end: { column: 15, line: 10 }, + }, + }, + + range: [169, 180], + loc: { + start: { column: 4, line: 10 }, + end: { column: 15, line: 10 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [165, 181], + loc: { + start: { column: 0, line: 10 }, + end: { column: 16, line: 10 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: AssignmentExpression { + type: 'AssignmentExpression', + left: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'globalThis', +- optional: false, + + range: [250, 260], + loc: { + start: { column: 0, line: 13 }, + end: { column: 10, line: 13 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'answer', +- optional: false, + + range: [261, 267], + loc: { + start: { column: 11, line: 13 }, + end: { column: 17, line: 13 }, + }, + }, + + range: [250, 267], + loc: { + start: { column: 0, line: 13 }, + end: { column: 17, line: 13 }, + }, + }, + operator: '=', + right: Literal { + type: 'Literal', + raw: '333333', + value: 333333, + + range: [270, 276], + loc: { + start: { column: 20, line: 13 }, + end: { column: 26, line: 13 }, + }, + }, + + range: [250, 276], + loc: { + start: { column: 0, line: 13 }, + end: { column: 26, line: 13 }, + }, + }, + + range: [250, 277], + loc: { + start: { column: 0, line: 13 }, + end: { column: 27, line: 13 }, + }, + }, + ], + sourceType: 'script', + + range: [95, 278], + loc: { + start: { column: 0, line: 5 }, + end: { column: 0, line: 14 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-declaration/snapshots/1-TSESTree-AST.shot index f1aaad0b7fe..95e0b482cc7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-declaration/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "TSImportEqualsDeclaration", id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [80, 83], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-declaration/snapshots/5-AST-Alignment-AST.shot index 53d30b6c9a3..49f1380ad7d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-declaration/snapshots/5-AST-Alignment-AST.shot @@ -12,7 +12,9 @@ exports[`AST Fixtures legacy-fixtures basics import-equal-declaration AST Alignm type: 'TSImportEqualsDeclaration', id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [80, 83], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-type-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-type-declaration/snapshots/1-TSESTree-AST.shot index 1e182a67683..6fb0e2dc1d7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-type-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-type-declaration/snapshots/1-TSESTree-AST.shot @@ -8,7 +8,9 @@ Program { type: "TSImportEqualsDeclaration", id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [85, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-type-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-type-declaration/snapshots/5-AST-Alignment-AST.shot index 28e095e445e..1a531882bcc 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-type-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-equal-type-declaration/snapshots/5-AST-Alignment-AST.shot @@ -12,7 +12,9 @@ exports[`AST Fixtures legacy-fixtures basics import-equal-type-declaration AST A type: 'TSImportEqualsDeclaration', id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [85, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-declaration/snapshots/1-TSESTree-AST.shot index c3c96f46cbf..ac43da0c1df 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-declaration/snapshots/1-TSESTree-AST.shot @@ -11,7 +11,9 @@ Program { type: "TSImportEqualsDeclaration", id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [87, 90], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-declaration/snapshots/5-AST-Alignment-AST.shot index c1e459d59ed..3f2c43b2642 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-declaration/snapshots/5-AST-Alignment-AST.shot @@ -15,7 +15,9 @@ exports[`AST Fixtures legacy-fixtures basics import-export-equal-declaration AST - type: 'TSImportEqualsDeclaration', - id: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'foo', +- optional: false, + TSImportEqualsDeclaration { + type: 'TSImportEqualsDeclaration', + id: Identifier { @@ -39,6 +41,13 @@ exports[`AST Fixtures legacy-fixtures basics import-export-equal-declaration AST - type: 'Literal', - raw: '\\\\'bar\\\\'', - value: 'bar', +- +- range: [101, 106], +- loc: { +- start: { column: 28, line: 3 }, +- end: { column: 33, line: 3 }, +- }, +- }, + }, + importKind: 'value', + isExport: true, @@ -49,13 +58,6 @@ exports[`AST Fixtures legacy-fixtures basics import-export-equal-declaration AST + raw: '\\\\'bar\\\\'', + value: 'bar', -- range: [101, 106], -- loc: { -- start: { column: 28, line: 3 }, -- end: { column: 33, line: 3 }, -- }, -- }, -- - range: [93, 107], + range: [101, 106], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/snapshots/1-TSESTree-AST.shot index 3a93ed389ea..7cae651ce2e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/snapshots/1-TSESTree-AST.shot @@ -11,7 +11,9 @@ Program { type: "TSImportEqualsDeclaration", id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [92, 95], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/snapshots/5-AST-Alignment-AST.shot index 7f8203572d5..171750fd750 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/snapshots/5-AST-Alignment-AST.shot @@ -15,7 +15,9 @@ exports[`AST Fixtures legacy-fixtures basics import-export-equal-type-declaratio - type: 'TSImportEqualsDeclaration', - id: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'foo', +- optional: false, + TSImportEqualsDeclaration { + type: 'TSImportEqualsDeclaration', + id: Identifier { @@ -39,6 +41,13 @@ exports[`AST Fixtures legacy-fixtures basics import-export-equal-type-declaratio - type: 'Literal', - raw: '\\\\'bar\\\\'', - value: 'bar', +- +- range: [106, 111], +- loc: { +- start: { column: 33, line: 3 }, +- end: { column: 38, line: 3 }, +- }, +- }, + }, + importKind: 'type', + isExport: true, @@ -49,13 +58,6 @@ exports[`AST Fixtures legacy-fixtures basics import-export-equal-type-declaratio + raw: '\\\\'bar\\\\'', + value: 'bar', -- range: [106, 111], -- loc: { -- start: { column: 33, line: 3 }, -- end: { column: 38, line: 3 }, -- }, -- }, -- - range: [98, 112], + range: [106, 111], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-default/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-default/snapshots/1-TSESTree-AST.shot index 48906852772..0c908ddf4b2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-default/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-default/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportDefaultSpecifier", local: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [85, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-default/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-default/snapshots/5-AST-Alignment-AST.shot index 56b8b3e68a6..2986d42d4c7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-default/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-default/snapshots/5-AST-Alignment-AST.shot @@ -28,7 +28,9 @@ exports[`AST Fixtures legacy-fixtures basics import-type-default AST Alignment - type: 'ImportDefaultSpecifier', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [85, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-empty/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-empty/snapshots/1-TSESTree-AST.shot index 0d60a3455a5..042403a7c01 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-empty/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-empty/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportDefaultSpecifier", local: Identifier { type: "Identifier", + decorators: Array [], name: "type", + optional: false, range: [135, 139], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-empty/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-empty/snapshots/5-AST-Alignment-AST.shot index c7fc07efd94..dc8848bb0a9 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-empty/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-empty/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,64 @@ exports[`AST Fixtures legacy-fixtures basics import-type-empty AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\\\'./foo\\\\'', + value: './foo', + + range: [145, 152], + loc: { + start: { column: 17, line: 4 }, + end: { column: 24, line: 4 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: 'ImportDefaultSpecifier', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'type', +- optional: false, + + range: [135, 139], + loc: { + start: { column: 7, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + + range: [135, 139], + loc: { + start: { column: 7, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + ], + + range: [128, 153], + loc: { + start: { column: 0, line: 4 }, + end: { column: 25, line: 4 }, + }, + }, + ], + sourceType: 'module', + + range: [128, 154], + loc: { + start: { column: 0, line: 4 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named-as/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named-as/snapshots/1-TSESTree-AST.shot index ea9e75a959d..9838901ae0a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named-as/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named-as/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [87, 90], loc: { @@ -35,7 +37,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [94, 97], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named-as/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named-as/snapshots/5-AST-Alignment-AST.shot index 3c407baaabe..4a1fa5a78d3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named-as/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named-as/snapshots/5-AST-Alignment-AST.shot @@ -28,7 +28,9 @@ exports[`AST Fixtures legacy-fixtures basics import-type-named-as AST Alignment type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [87, 90], loc: { @@ -39,7 +41,9 @@ exports[`AST Fixtures legacy-fixtures basics import-type-named-as AST Alignment importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [94, 97], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named/snapshots/1-TSESTree-AST.shot index b7bd3d542ff..d09de11c2ce 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [87, 90], loc: { @@ -35,7 +37,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [87, 90], loc: { @@ -54,7 +58,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [92, 95], loc: { @@ -65,7 +71,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [92, 95], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named/snapshots/5-AST-Alignment-AST.shot index 228d178064a..731c672720f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-named/snapshots/5-AST-Alignment-AST.shot @@ -28,7 +28,9 @@ exports[`AST Fixtures legacy-fixtures basics import-type-named AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [87, 90], loc: { @@ -39,7 +41,9 @@ exports[`AST Fixtures legacy-fixtures basics import-type-named AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [87, 90], loc: { @@ -58,7 +62,9 @@ exports[`AST Fixtures legacy-fixtures basics import-type-named AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [92, 95], loc: { @@ -69,7 +75,9 @@ exports[`AST Fixtures legacy-fixtures basics import-type-named AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [92, 95], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-star-as-ns/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-star-as-ns/snapshots/1-TSESTree-AST.shot index 1124bbe8ceb..816e60b9f38 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-star-as-ns/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-star-as-ns/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportNamespaceSpecifier", local: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [90, 93], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-star-as-ns/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-star-as-ns/snapshots/5-AST-Alignment-AST.shot index 57f1afe7c7b..0195c7b483b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-star-as-ns/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-type-star-as-ns/snapshots/5-AST-Alignment-AST.shot @@ -28,7 +28,9 @@ exports[`AST Fixtures legacy-fixtures basics import-type-star-as-ns AST Alignmen type: 'ImportNamespaceSpecifier', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [90, 93], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-with-import-assertions/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-with-import-assertions/snapshots/1-TSESTree-AST.shot index 0fbc4660b19..f7aca362839 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-with-import-assertions/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-with-import-assertions/snapshots/1-TSESTree-AST.shot @@ -11,7 +11,9 @@ Program { type: "ImportAttribute", key: Identifier { type: "Identifier", + decorators: Array [], name: "type", + optional: false, range: [104, 108], loc: { @@ -55,7 +57,9 @@ Program { type: "ImportDefaultSpecifier", local: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [80, 83], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-with-import-assertions/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-with-import-assertions/snapshots/5-AST-Alignment-AST.shot index 5c25cc16fb8..62346b37082 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-with-import-assertions/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/import-with-import-assertions/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,97 @@ exports[`AST Fixtures legacy-fixtures basics import-with-import-assertions AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [ + ImportAttribute { + type: 'ImportAttribute', + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'type', +- optional: false, + + range: [104, 108], + loc: { + start: { column: 31, line: 3 }, + end: { column: 35, line: 3 }, + }, + }, + value: Literal { + type: 'Literal', + raw: '\\\\'json\\\\'', + value: 'json', + + range: [110, 116], + loc: { + start: { column: 37, line: 3 }, + end: { column: 43, line: 3 }, + }, + }, + + range: [104, 116], + loc: { + start: { column: 31, line: 3 }, + end: { column: 43, line: 3 }, + }, + }, + ], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\\\'mod\\\\'', + value: 'mod', + + range: [89, 94], + loc: { + start: { column: 16, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: 'ImportDefaultSpecifier', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [80, 83], + loc: { + start: { column: 7, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + + range: [80, 83], + loc: { + start: { column: 7, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + ], + + range: [73, 119], + loc: { + start: { column: 0, line: 3 }, + end: { column: 46, line: 3 }, + }, + }, + ], + sourceType: 'module', + + range: [73, 120], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends-multiple/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends-multiple/snapshots/1-TSESTree-AST.shot index c8a902ea54a..7521847058b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends-multiple/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends-multiple/snapshots/1-TSESTree-AST.shot @@ -16,12 +16,15 @@ Program { end: { column: 33, line: 3 }, }, }, + declare: false, extends: Array [ TSInterfaceHeritage { type: "TSInterfaceHeritage", expression: Identifier { type: "Identifier", + decorators: Array [], name: "Bar", + optional: false, range: [95, 98], loc: { @@ -40,7 +43,9 @@ Program { type: "TSInterfaceHeritage", expression: Identifier { type: "Identifier", + decorators: Array [], name: "Baz", + optional: false, range: [100, 103], loc: { @@ -58,7 +63,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends-multiple/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends-multiple/snapshots/5-AST-Alignment-AST.shot index 6826fae73fb..2b7e65472a4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends-multiple/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends-multiple/snapshots/5-AST-Alignment-AST.shot @@ -20,6 +20,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-extends-multiple AST Alig end: { column: 33, line: 3 }, }, }, +- declare: false, extends: Array [ - TSInterfaceHeritage { - type: 'TSInterfaceHeritage', @@ -27,7 +28,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-extends-multiple AST Alig + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [95, 98], loc: { @@ -48,7 +51,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-extends-multiple AST Alig + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Baz', +- optional: false, range: [100, 103], loc: { @@ -66,7 +71,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-extends-multiple AST Alig ], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends/snapshots/1-TSESTree-AST.shot index 74441083761..118bdf6cd7f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends/snapshots/1-TSESTree-AST.shot @@ -16,12 +16,15 @@ Program { end: { column: 28, line: 3 }, }, }, + declare: false, extends: Array [ TSInterfaceHeritage { type: "TSInterfaceHeritage", expression: Identifier { type: "Identifier", + decorators: Array [], name: "Bar", + optional: false, range: [95, 98], loc: { @@ -39,7 +42,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends/snapshots/5-AST-Alignment-AST.shot index 5d2ae168cc4..a1f3cec6078 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-extends/snapshots/5-AST-Alignment-AST.shot @@ -20,6 +20,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-extends AST Alignment - A end: { column: 28, line: 3 }, }, }, +- declare: false, extends: Array [ - TSInterfaceHeritage { - type: 'TSInterfaceHeritage', @@ -27,7 +28,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-extends AST Alignment - A + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [95, 98], loc: { @@ -45,7 +48,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-extends AST Alignment - A ], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-type-parameters/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-type-parameters/snapshots/1-TSESTree-AST.shot index 316e2a82e7f..7279000bdda 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-type-parameters/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-type-parameters/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,13 @@ Program { end: { column: 19, line: 3 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [83, 86], loc: { @@ -34,7 +38,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [87, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-type-parameters/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-type-parameters/snapshots/5-AST-Alignment-AST.shot index ce9b773200c..06030947117 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-type-parameters/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-type-parameters/snapshots/5-AST-Alignment-AST.shot @@ -20,9 +20,13 @@ exports[`AST Fixtures legacy-fixtures basics interface-type-parameters AST Align end: { column: 19, line: 3 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [83, 86], loc: { @@ -38,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-type-parameters AST Align - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [87, 88], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-all-property-types/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-all-property-types/snapshots/1-TSESTree-AST.shot index 2b42ff502a9..88a43f2fd9d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-all-property-types/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-all-property-types/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "baa", + optional: false, range: [91, 94], loc: { @@ -22,6 +24,9 @@ Program { end: { column: 5, line: 4 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -52,7 +57,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [106, 109], loc: { @@ -61,6 +68,8 @@ Program { }, }, optional: true, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -91,7 +100,9 @@ Program { computed: true, key: Identifier { type: "Identifier", + decorators: Array [], name: "bax", + optional: false, range: [123, 126], loc: { @@ -99,6 +110,9 @@ Program { end: { column: 6, line: 6 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -129,7 +143,9 @@ Program { computed: true, key: Identifier { type: "Identifier", + decorators: Array [], name: "baz", + optional: false, range: [140, 143], loc: { @@ -138,6 +154,8 @@ Program { }, }, optional: true, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -168,7 +186,9 @@ Program { parameters: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "eee", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -195,6 +215,8 @@ Program { }, }, ], + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -225,7 +247,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "doo", + optional: false, range: [182, 185], loc: { @@ -234,7 +258,9 @@ Program { }, }, kind: "method", + optional: false, params: Array [], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSVoidKeyword { @@ -253,6 +279,7 @@ Program { end: { column: 13, line: 9 }, }, }, + static: false, range: [182, 194], loc: { @@ -265,7 +292,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "coo", + optional: false, range: [197, 200], loc: { @@ -278,7 +307,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [202, 203], loc: { @@ -288,7 +319,9 @@ Program { }, Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [205, 206], loc: { @@ -298,7 +331,9 @@ Program { }, Identifier { type: "Identifier", + decorators: Array [], name: "c", + optional: false, range: [208, 209], loc: { @@ -307,6 +342,7 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSVoidKeyword { @@ -325,6 +361,7 @@ Program { end: { column: 21, line: 10 }, }, }, + static: false, range: [197, 217], loc: { @@ -337,7 +374,9 @@ Program { computed: true, key: Identifier { type: "Identifier", + decorators: Array [], name: "loo", + optional: false, range: [221, 224], loc: { @@ -350,7 +389,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [227, 228], loc: { @@ -360,7 +401,9 @@ Program { }, Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [230, 231], loc: { @@ -370,7 +413,9 @@ Program { }, Identifier { type: "Identifier", + decorators: Array [], name: "c", + optional: false, range: [233, 234], loc: { @@ -379,6 +424,7 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSVoidKeyword { @@ -397,6 +443,7 @@ Program { end: { column: 23, line: 11 }, }, }, + static: false, range: [220, 242], loc: { @@ -409,7 +456,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "boo", + optional: false, range: [245, 248], loc: { @@ -418,10 +467,13 @@ Program { }, }, kind: "method", + optional: false, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [252, 253], loc: { @@ -431,7 +483,9 @@ Program { }, Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [255, 256], loc: { @@ -441,7 +495,9 @@ Program { }, Identifier { type: "Identifier", + decorators: Array [], name: "c", + optional: false, range: [258, 259], loc: { @@ -450,6 +506,7 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSVoidKeyword { @@ -468,6 +525,7 @@ Program { end: { column: 23, line: 12 }, }, }, + static: false, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", params: Array [ @@ -476,7 +534,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "J", + optional: false, range: [249, 250], loc: { @@ -512,7 +572,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [275, 276], loc: { @@ -522,6 +584,7 @@ Program { }, Identifier { type: "Identifier", + decorators: Array [], name: "b", optional: true, @@ -562,7 +625,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [301, 302], loc: { @@ -572,6 +637,7 @@ Program { }, Identifier { type: "Identifier", + decorators: Array [], name: "b", optional: true, @@ -608,7 +674,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "F", + optional: false, range: [298, 299], loc: { @@ -647,9 +715,13 @@ Program { end: { column: 1, line: 15 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-all-property-types/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-all-property-types/snapshots/5-AST-Alignment-AST.shot index abf4bc97439..416365ea7f0 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-all-property-types/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-all-property-types/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baa', +- optional: false, range: [91, 94], loc: { @@ -26,6 +28,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A end: { column: 5, line: 4 }, }, }, +- optional: false, +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -56,7 +61,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [106, 109], loc: { @@ -65,6 +72,8 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, }, optional: true, +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -95,7 +104,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A computed: true, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bax', +- optional: false, range: [123, 126], loc: { @@ -103,6 +114,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A end: { column: 6, line: 6 }, }, }, +- optional: false, +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -133,7 +147,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A computed: true, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [140, 143], loc: { @@ -142,6 +158,8 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, }, optional: true, +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -172,7 +190,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'eee', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -199,6 +219,8 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, }, ], +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -229,7 +251,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'doo', +- optional: false, range: [182, 185], loc: { @@ -238,7 +262,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, }, kind: 'method', +- optional: false, - params: Array [], +- readonly: false, - returnType: TSTypeAnnotation { + parameters: Array [], + typeAnnotation: TSTypeAnnotation { @@ -259,6 +285,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A end: { column: 13, line: 9 }, }, }, +- static: false, range: [182, 194], loc: { @@ -271,7 +298,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'coo', +- optional: false, range: [197, 200], loc: { @@ -285,7 +314,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [202, 203], loc: { @@ -295,7 +326,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [205, 206], loc: { @@ -305,7 +338,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'c', +- optional: false, range: [208, 209], loc: { @@ -314,6 +349,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -333,6 +369,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A end: { column: 21, line: 10 }, }, }, +- static: false, range: [197, 217], loc: { @@ -345,7 +382,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A computed: true, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'loo', +- optional: false, range: [221, 224], loc: { @@ -359,7 +398,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [227, 228], loc: { @@ -369,7 +410,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [230, 231], loc: { @@ -379,7 +422,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'c', +- optional: false, range: [233, 234], loc: { @@ -388,6 +433,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -407,6 +453,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A end: { column: 23, line: 11 }, }, }, +- static: false, range: [220, 242], loc: { @@ -419,7 +466,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'boo', +- optional: false, range: [245, 248], loc: { @@ -428,11 +477,14 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, }, kind: 'method', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [252, 253], loc: { @@ -442,7 +494,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [255, 256], loc: { @@ -452,7 +506,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'c', +- optional: false, range: [258, 259], loc: { @@ -461,6 +517,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -480,6 +537,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A end: { column: 23, line: 12 }, }, }, +- static: false, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', params: Array [ @@ -488,7 +546,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'J', +- optional: false, - - range: [249, 250], - loc: { @@ -526,7 +586,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [275, 276], loc: { @@ -536,6 +598,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', optional: true, @@ -578,7 +641,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [301, 302], loc: { @@ -588,6 +653,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', optional: true, @@ -625,7 +691,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'F', +- optional: false, - - range: [298, 299], - loc: { @@ -665,9 +733,13 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-all-property-types A end: { column: 1, line: 15 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-member-expression/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-member-expression/snapshots/1-TSESTree-AST.shot index 2fff8125b60..90cf436fde7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-member-expression/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-member-expression/snapshots/1-TSESTree-AST.shot @@ -16,6 +16,7 @@ Program { end: { column: 32, line: 3 }, }, }, + declare: false, extends: Array [ TSInterfaceHeritage { type: "TSInterfaceHeritage", @@ -24,7 +25,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [95, 98], loc: { @@ -35,7 +38,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "baz", + optional: false, range: [99, 102], loc: { @@ -60,7 +65,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-member-expression/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-member-expression/snapshots/5-AST-Alignment-AST.shot index 815cf476af7..cfc7b70c381 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-member-expression/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-member-expression/snapshots/5-AST-Alignment-AST.shot @@ -20,6 +20,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-extends-member-expre end: { column: 32, line: 3 }, }, }, +- declare: false, extends: Array [ - TSInterfaceHeritage { - type: 'TSInterfaceHeritage', @@ -33,7 +34,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-extends-member-expre + type: 'TSQualifiedName', + left: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [95, 98], loc: { @@ -45,7 +48,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-extends-member-expre - property: Identifier { + right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [99, 102], loc: { @@ -70,7 +75,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-extends-member-expre ], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/1-TSESTree-AST.shot index ba51eeaf2bc..2a9874b67ba 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/1-TSESTree-AST.shot @@ -16,12 +16,15 @@ Program { end: { column: 34, line: 3 }, }, }, + declare: false, extends: Array [ TSInterfaceHeritage { type: "TSInterfaceHeritage", expression: Identifier { type: "Identifier", + decorators: Array [], name: "Bar", + optional: false, range: [98, 101], loc: { @@ -36,7 +39,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "J", + optional: false, range: [102, 103], loc: { @@ -66,7 +71,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "J", + optional: false, range: [102, 103], loc: { @@ -99,7 +106,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [83, 86], loc: { @@ -115,7 +124,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [87, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/5-AST-Alignment-AST.shot index 8743d1a6baf..27684fa7dc2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-extends-type-parameters/snapshots/5-AST-Alignment-AST.shot @@ -20,6 +20,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-extends-type-paramet end: { column: 34, line: 3 }, }, }, +- declare: false, extends: Array [ - TSInterfaceHeritage { - type: 'TSInterfaceHeritage', @@ -27,14 +28,16 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-extends-type-paramet + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Bar', +- optional: false, range: [98, 101], loc: { start: { column: 25, line: 3 }, end: { column: 28, line: 3 }, - }, - }, +- }, +- }, - typeArguments: TSTypeParameterInstantiation { - type: 'TSTypeParameterInstantiation', - params: Array [ @@ -42,7 +45,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-extends-type-paramet - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'J', +- optional: false, - - range: [102, 103], - loc: { @@ -63,8 +68,8 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-extends-type-paramet - loc: { - start: { column: 28, line: 3 }, - end: { column: 31, line: 3 }, -- }, -- }, + }, + }, typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ @@ -72,7 +77,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-extends-type-paramet type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'J', +- optional: false, range: [102, 103], loc: { @@ -105,7 +112,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-extends-type-paramet ], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [83, 86], loc: { @@ -121,7 +130,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-extends-type-paramet - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [87, 88], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-generic/snapshots/1-TSESTree-AST.shot index d3e96136ef6..75da0347e82 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-generic/snapshots/1-TSESTree-AST.shot @@ -16,9 +16,13 @@ Program { end: { column: 20, line: 3 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Test", + optional: false, range: [83, 87], loc: { @@ -34,7 +38,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [88, 89], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-generic/snapshots/5-AST-Alignment-AST.shot index bcc3599d418..298a851d00b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-generic/snapshots/5-AST-Alignment-AST.shot @@ -20,9 +20,13 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-generic AST Alignmen end: { column: 20, line: 3 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Test', +- optional: false, range: [83, 87], loc: { @@ -38,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-generic AST Alignmen - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [88, 89], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-jsdoc/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-jsdoc/snapshots/1-TSESTree-AST.shot index 443b6bf8e9f..757e29942e9 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-jsdoc/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-jsdoc/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [138, 141], loc: { @@ -23,10 +25,13 @@ Program { }, }, kind: "method", + optional: false, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [142, 145], loc: { @@ -35,6 +40,8 @@ Program { }, }, ], + readonly: false, + static: false, range: [138, 147], loc: { @@ -50,9 +57,13 @@ Program { end: { column: 1, line: 9 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Test", + optional: false, range: [83, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-jsdoc/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-jsdoc/snapshots/5-AST-Alignment-AST.shot index cbdfb2688e0..fffa02b876d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-jsdoc/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-jsdoc/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-jsdoc AST Alignment computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [138, 141], loc: { @@ -27,11 +29,14 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-jsdoc AST Alignment }, }, kind: 'method', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [142, 145], loc: { @@ -40,6 +45,8 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-jsdoc AST Alignment }, }, ], +- readonly: false, +- static: false, range: [138, 147], loc: { @@ -55,9 +62,13 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-jsdoc AST Alignment end: { column: 1, line: 9 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Test', +- optional: false, range: [83, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-method/snapshots/1-TSESTree-AST.shot index a85e5d164fc..2591787a02b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-method/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "h", + optional: false, range: [92, 93], loc: { @@ -23,10 +25,13 @@ Program { }, }, kind: "method", + optional: false, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -53,6 +58,7 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSVoidKeyword { @@ -71,6 +77,7 @@ Program { end: { column: 22, line: 4 }, }, }, + static: false, range: [92, 113], loc: { @@ -83,7 +90,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "g", + optional: false, range: [116, 117], loc: { @@ -92,17 +101,22 @@ Program { }, }, kind: "method", + optional: false, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [126, 127], loc: { @@ -132,13 +146,16 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [130, 131], loc: { @@ -160,6 +177,7 @@ Program { end: { column: 17, line: 5 }, }, }, + static: false, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", params: Array [ @@ -168,7 +186,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [118, 119], loc: { @@ -207,9 +227,13 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "test", + optional: false, range: [83, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-method/snapshots/5-AST-Alignment-AST.shot index f6f48a1fa51..e1cdfe1d677 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-method/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'h', +- optional: false, range: [92, 93], loc: { @@ -27,11 +29,14 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment }, }, kind: 'method', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -58,6 +63,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -77,6 +83,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment end: { column: 22, line: 4 }, }, }, +- static: false, range: [92, 113], loc: { @@ -89,7 +96,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'g', +- optional: false, range: [116, 117], loc: { @@ -98,18 +107,23 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment }, }, kind: 'method', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [126, 127], loc: { @@ -139,6 +153,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -146,7 +161,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [130, 131], loc: { @@ -168,6 +185,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment end: { column: 17, line: 5 }, }, }, +- static: false, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', params: Array [ @@ -176,7 +194,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [118, 119], - loc: { @@ -216,9 +236,13 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-method AST Alignment end: { column: 1, line: 6 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'test', +- optional: false, range: [83, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-optional-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-optional-properties/snapshots/1-TSESTree-AST.shot index cde7ed06ee0..a27dfa78067 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-optional-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-optional-properties/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [92, 95], loc: { @@ -23,6 +25,8 @@ Program { }, }, optional: true, + readonly: false, + static: false, range: [92, 97], loc: { @@ -35,7 +39,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [100, 103], loc: { @@ -44,6 +50,8 @@ Program { }, }, optional: true, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -74,7 +82,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "baz", + optional: false, range: [116, 119], loc: { @@ -87,7 +97,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [121, 124], loc: { @@ -97,6 +109,7 @@ Program { }, Identifier { type: "Identifier", + decorators: Array [], name: "bar", optional: true, typeAnnotation: TSTypeAnnotation { @@ -126,6 +139,7 @@ Program { }, Identifier { type: "Identifier", + decorators: Array [], name: "baz", optional: true, @@ -136,6 +150,8 @@ Program { }, }, ], + readonly: false, + static: false, range: [116, 146], loc: { @@ -151,9 +167,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "test", + optional: false, range: [83, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-optional-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-optional-properties/snapshots/5-AST-Alignment-AST.shot index 0f17f468b7b..af590c0b0ab 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-optional-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-with-optional-properties/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-optional-properties computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [92, 95], loc: { @@ -27,6 +29,8 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-optional-properties }, }, optional: true, +- readonly: false, +- static: false, range: [92, 97], loc: { @@ -39,7 +43,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-optional-properties computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [100, 103], loc: { @@ -48,6 +54,8 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-optional-properties }, }, optional: true, +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -78,7 +86,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-optional-properties computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [116, 119], loc: { @@ -92,7 +102,9 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-optional-properties + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [121, 124], loc: { @@ -102,6 +114,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-optional-properties }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', optional: true, typeAnnotation: TSTypeAnnotation { @@ -131,6 +144,7 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-optional-properties }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', optional: true, @@ -141,6 +155,8 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-optional-properties }, }, ], +- readonly: false, +- static: false, range: [116, 146], loc: { @@ -156,9 +172,13 @@ exports[`AST Fixtures legacy-fixtures basics interface-with-optional-properties end: { column: 1, line: 7 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'test', +- optional: false, range: [83, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-without-type-annotation/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-without-type-annotation/snapshots/1-TSESTree-AST.shot index 6f23be9edb7..58997d98fdd 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-without-type-annotation/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-without-type-annotation/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [92, 95], loc: { @@ -22,6 +24,9 @@ Program { end: { column: 5, line: 4 }, }, }, + optional: false, + readonly: false, + static: false, range: [92, 96], loc: { @@ -37,9 +42,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "test", + optional: false, range: [83, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-without-type-annotation/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-without-type-annotation/snapshots/5-AST-Alignment-AST.shot index 3f71028931f..39414f7c3b6 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-without-type-annotation/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/interface-without-type-annotation/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,78 @@ exports[`AST Fixtures legacy-fixtures basics interface-without-type-annotation AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSInterfaceDeclaration { + type: 'TSInterfaceDeclaration', + body: TSInterfaceBody { + type: 'TSInterfaceBody', + body: Array [ + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [92, 95], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + + range: [92, 96], + loc: { + start: { column: 2, line: 4 }, + end: { column: 6, line: 4 }, + }, + }, + ], + + range: [88, 98], + loc: { + start: { column: 15, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, +- declare: false, +- extends: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'test', +- optional: false, + + range: [83, 87], + loc: { + start: { column: 10, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [73, 98], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 99], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/intrinsic-keyword/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/intrinsic-keyword/snapshots/1-TSESTree-AST.shot index 709dafa02b5..e7999a26c62 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/intrinsic-keyword/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/intrinsic-keyword/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Uppercase", + optional: false, range: [78, 87], loc: { @@ -42,7 +45,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "S", + optional: false, range: [88, 89], loc: { @@ -75,9 +80,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Lowercase", + optional: false, range: [124, 133], loc: { @@ -111,7 +119,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "S", + optional: false, range: [134, 135], loc: { @@ -144,9 +154,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Capitalize", + optional: false, range: [170, 180], loc: { @@ -180,7 +193,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "S", + optional: false, range: [181, 182], loc: { @@ -213,9 +228,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Uncapitalize", + optional: false, range: [217, 229], loc: { @@ -249,7 +267,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "S", + optional: false, range: [230, 231], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/intrinsic-keyword/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/intrinsic-keyword/snapshots/5-AST-Alignment-AST.shot index 69311fed221..aec11cf1443 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/intrinsic-keyword/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/intrinsic-keyword/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures basics intrinsic-keyword AST Alignment - A body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Uppercase', +- optional: false, range: [78, 87], loc: { @@ -46,7 +49,9 @@ exports[`AST Fixtures legacy-fixtures basics intrinsic-keyword AST Alignment - A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'S', +- optional: false, - - range: [88, 89], - loc: { @@ -80,9 +85,12 @@ exports[`AST Fixtures legacy-fixtures basics intrinsic-keyword AST Alignment - A }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Lowercase', +- optional: false, range: [124, 133], loc: { @@ -111,19 +119,21 @@ exports[`AST Fixtures legacy-fixtures basics intrinsic-keyword AST Alignment - A loc: { start: { column: 25, line: 4 }, end: { column: 31, line: 4 }, -- }, -- }, + }, + }, - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'S', +- optional: false, - - range: [134, 135], - loc: { - start: { column: 15, line: 4 }, - end: { column: 16, line: 4 }, - }, - }, +- }, +- }, - out: false, + name: 'S', @@ -150,9 +160,12 @@ exports[`AST Fixtures legacy-fixtures basics intrinsic-keyword AST Alignment - A }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Capitalize', +- optional: false, range: [170, 180], loc: { @@ -181,19 +194,21 @@ exports[`AST Fixtures legacy-fixtures basics intrinsic-keyword AST Alignment - A loc: { start: { column: 26, line: 5 }, end: { column: 32, line: 5 }, -- }, -- }, + }, + }, - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'S', +- optional: false, - - range: [181, 182], - loc: { - start: { column: 16, line: 5 }, - end: { column: 17, line: 5 }, - }, - }, +- }, +- }, - out: false, + name: 'S', @@ -220,9 +235,12 @@ exports[`AST Fixtures legacy-fixtures basics intrinsic-keyword AST Alignment - A }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Uncapitalize', +- optional: false, range: [217, 229], loc: { @@ -256,7 +274,9 @@ exports[`AST Fixtures legacy-fixtures basics intrinsic-keyword AST Alignment - A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'S', +- optional: false, - - range: [230, 231], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyof-operator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyof-operator/snapshots/1-TSESTree-AST.shot index b5752b0534b..43a669a653a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyof-operator/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyof-operator/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [78, 79], loc: { @@ -23,7 +26,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [88, 91], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyof-operator/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyof-operator/snapshots/5-AST-Alignment-AST.shot index 066f52e976f..31b817f0994 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyof-operator/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyof-operator/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,72 @@ exports[`AST Fixtures legacy-fixtures basics keyof-operator AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [78, 79], + loc: { + start: { column: 5, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + typeAnnotation: TSTypeOperator { + type: 'TSTypeOperator', + operator: 'keyof', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [88, 91], + loc: { + start: { column: 15, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [82, 91], + loc: { + start: { column: 9, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 93], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/1-TSESTree-AST.shot index 962ee2d70e0..67ad28e95e4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/1-TSESTree-AST.shot @@ -12,9 +12,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "abstract", + optional: false, range: [83, 91], loc: { @@ -41,6 +44,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [77, 96], @@ -54,9 +58,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "as", + optional: false, range: [105, 107], loc: { @@ -83,6 +90,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [99, 112], @@ -96,9 +104,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "asserts", + optional: false, range: [121, 128], loc: { @@ -125,6 +136,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [115, 133], @@ -138,9 +150,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "any", + optional: false, range: [142, 145], loc: { @@ -167,6 +182,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [136, 150], @@ -180,9 +196,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "async", + optional: false, range: [159, 164], loc: { @@ -209,6 +228,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [153, 169], @@ -222,9 +242,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "await", + optional: false, range: [178, 183], loc: { @@ -251,6 +274,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [172, 188], @@ -264,9 +288,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "boolean", + optional: false, range: [197, 204], loc: { @@ -293,6 +320,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [191, 209], @@ -306,9 +334,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "constructor", + optional: false, range: [218, 229], loc: { @@ -335,6 +366,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [212, 234], @@ -348,9 +380,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "declare", + optional: false, range: [243, 250], loc: { @@ -377,6 +412,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [237, 255], @@ -390,9 +426,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "get", + optional: false, range: [264, 267], loc: { @@ -419,6 +458,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [258, 272], @@ -432,9 +472,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "infer", + optional: false, range: [281, 286], loc: { @@ -461,6 +504,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [275, 291], @@ -474,9 +518,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "is", + optional: false, range: [300, 302], loc: { @@ -503,6 +550,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [294, 307], @@ -516,9 +564,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "keyof", + optional: false, range: [316, 321], loc: { @@ -545,6 +596,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [310, 326], @@ -558,9 +610,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "module", + optional: false, range: [335, 341], loc: { @@ -587,6 +642,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [329, 346], @@ -600,9 +656,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "namespace", + optional: false, range: [355, 364], loc: { @@ -629,6 +688,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [349, 369], @@ -642,9 +702,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "never", + optional: false, range: [378, 383], loc: { @@ -671,6 +734,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [372, 388], @@ -684,9 +748,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "readonly", + optional: false, range: [397, 405], loc: { @@ -713,6 +780,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [391, 410], @@ -726,9 +794,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "require", + optional: false, range: [419, 426], loc: { @@ -755,6 +826,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [413, 431], @@ -768,9 +840,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "number", + optional: false, range: [440, 446], loc: { @@ -797,6 +872,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [434, 451], @@ -810,9 +886,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "object", + optional: false, range: [460, 466], loc: { @@ -839,6 +918,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [454, 471], @@ -852,9 +932,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "set", + optional: false, range: [480, 483], loc: { @@ -881,6 +964,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [474, 488], @@ -894,9 +978,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "string", + optional: false, range: [497, 503], loc: { @@ -923,6 +1010,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [491, 508], @@ -936,9 +1024,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "symbol", + optional: false, range: [517, 523], loc: { @@ -965,6 +1056,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [511, 528], @@ -978,9 +1070,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "type", + optional: false, range: [537, 541], loc: { @@ -1007,6 +1102,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [531, 546], @@ -1020,9 +1116,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "undefined", + optional: false, range: [555, 564], loc: { @@ -1049,6 +1148,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [549, 569], @@ -1062,9 +1162,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "unique", + optional: false, range: [578, 584], loc: { @@ -1091,6 +1194,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [572, 589], @@ -1104,9 +1208,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "unknown", + optional: false, range: [598, 605], loc: { @@ -1133,6 +1240,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [592, 610], @@ -1146,9 +1254,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "from", + optional: false, range: [619, 623], loc: { @@ -1175,6 +1286,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [613, 628], @@ -1188,9 +1300,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "global", + optional: false, range: [637, 643], loc: { @@ -1217,6 +1332,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [631, 648], @@ -1230,9 +1346,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "bigint", + optional: false, range: [657, 663], loc: { @@ -1259,6 +1378,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [651, 668], @@ -1272,9 +1392,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "of", + optional: false, range: [677, 679], loc: { @@ -1301,6 +1424,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [671, 684], @@ -1337,7 +1461,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "abstract", + optional: false, range: [699, 707], loc: { @@ -1348,7 +1474,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "abstract", + optional: false, range: [699, 707], loc: { @@ -1367,7 +1495,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "as", + optional: false, range: [711, 713], loc: { @@ -1378,7 +1508,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "as", + optional: false, range: [711, 713], loc: { @@ -1397,7 +1529,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "asserts", + optional: false, range: [717, 724], loc: { @@ -1408,7 +1542,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "asserts", + optional: false, range: [717, 724], loc: { @@ -1427,7 +1563,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "any", + optional: false, range: [728, 731], loc: { @@ -1438,7 +1576,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "any", + optional: false, range: [728, 731], loc: { @@ -1457,7 +1597,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "async", + optional: false, range: [735, 740], loc: { @@ -1468,7 +1610,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "async", + optional: false, range: [735, 740], loc: { @@ -1487,7 +1631,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "await", + optional: false, range: [744, 749], loc: { @@ -1498,7 +1644,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "await", + optional: false, range: [744, 749], loc: { @@ -1517,7 +1665,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "boolean", + optional: false, range: [753, 760], loc: { @@ -1528,7 +1678,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "boolean", + optional: false, range: [753, 760], loc: { @@ -1547,7 +1699,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "constructor", + optional: false, range: [764, 775], loc: { @@ -1558,7 +1712,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "constructor", + optional: false, range: [764, 775], loc: { @@ -1577,7 +1733,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "declare", + optional: false, range: [779, 786], loc: { @@ -1588,7 +1746,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "declare", + optional: false, range: [779, 786], loc: { @@ -1607,7 +1767,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "get", + optional: false, range: [790, 793], loc: { @@ -1618,7 +1780,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "get", + optional: false, range: [790, 793], loc: { @@ -1637,7 +1801,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "infer", + optional: false, range: [797, 802], loc: { @@ -1648,7 +1814,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "infer", + optional: false, range: [797, 802], loc: { @@ -1667,7 +1835,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "is", + optional: false, range: [806, 808], loc: { @@ -1678,7 +1848,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "is", + optional: false, range: [806, 808], loc: { @@ -1697,7 +1869,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "keyof", + optional: false, range: [812, 817], loc: { @@ -1708,7 +1882,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "keyof", + optional: false, range: [812, 817], loc: { @@ -1727,7 +1903,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "module", + optional: false, range: [821, 827], loc: { @@ -1738,7 +1916,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "module", + optional: false, range: [821, 827], loc: { @@ -1757,7 +1937,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "namespace", + optional: false, range: [831, 840], loc: { @@ -1768,7 +1950,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "namespace", + optional: false, range: [831, 840], loc: { @@ -1787,7 +1971,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "never", + optional: false, range: [844, 849], loc: { @@ -1798,7 +1984,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "never", + optional: false, range: [844, 849], loc: { @@ -1817,7 +2005,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "readonly", + optional: false, range: [853, 861], loc: { @@ -1828,7 +2018,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "readonly", + optional: false, range: [853, 861], loc: { @@ -1847,7 +2039,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "require", + optional: false, range: [865, 872], loc: { @@ -1858,7 +2052,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "require", + optional: false, range: [865, 872], loc: { @@ -1877,7 +2073,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "number", + optional: false, range: [876, 882], loc: { @@ -1888,7 +2086,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "number", + optional: false, range: [876, 882], loc: { @@ -1907,7 +2107,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "object", + optional: false, range: [886, 892], loc: { @@ -1918,7 +2120,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "object", + optional: false, range: [886, 892], loc: { @@ -1937,7 +2141,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "set", + optional: false, range: [896, 899], loc: { @@ -1948,7 +2154,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "set", + optional: false, range: [896, 899], loc: { @@ -1967,7 +2175,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "string", + optional: false, range: [903, 909], loc: { @@ -1978,7 +2188,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "string", + optional: false, range: [903, 909], loc: { @@ -1997,7 +2209,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "symbol", + optional: false, range: [913, 919], loc: { @@ -2008,7 +2222,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "symbol", + optional: false, range: [913, 919], loc: { @@ -2027,7 +2243,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "type", + optional: false, range: [923, 927], loc: { @@ -2038,7 +2256,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "type", + optional: false, range: [923, 927], loc: { @@ -2057,7 +2277,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "undefined", + optional: false, range: [931, 940], loc: { @@ -2068,7 +2290,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "undefined", + optional: false, range: [931, 940], loc: { @@ -2087,7 +2311,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "unique", + optional: false, range: [944, 950], loc: { @@ -2098,7 +2324,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "unique", + optional: false, range: [944, 950], loc: { @@ -2117,7 +2345,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "unknown", + optional: false, range: [954, 961], loc: { @@ -2128,7 +2358,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "unknown", + optional: false, range: [954, 961], loc: { @@ -2147,7 +2379,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "from", + optional: false, range: [965, 969], loc: { @@ -2158,7 +2392,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "from", + optional: false, range: [965, 969], loc: { @@ -2177,7 +2413,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "global", + optional: false, range: [973, 979], loc: { @@ -2188,7 +2426,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "global", + optional: false, range: [973, 979], loc: { @@ -2207,7 +2447,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "bigint", + optional: false, range: [983, 989], loc: { @@ -2218,7 +2460,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "bigint", + optional: false, range: [983, 989], loc: { @@ -2237,7 +2481,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "of", + optional: false, range: [993, 995], loc: { @@ -2248,7 +2494,9 @@ Program { importKind: "value", local: Identifier { type: "Identifier", + decorators: Array [], name: "of", + optional: false, range: [993, 995], loc: { @@ -2283,9 +2531,13 @@ Program { end: { column: 14, line: 71 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "X", + optional: false, range: [1030, 1031], loc: { @@ -2302,15 +2554,19 @@ Program { }, ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [1067, 1068], loc: { @@ -2319,6 +2575,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: true, value: FunctionExpression { @@ -2334,6 +2591,7 @@ Program { end: { column: 15, line: 73 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -2356,9 +2614,12 @@ Program { type: "MethodDefinition", accessibility: "private", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [1084, 1085], loc: { @@ -2367,6 +2628,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -2382,6 +2644,7 @@ Program { end: { column: 16, line: 74 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -2404,9 +2667,12 @@ Program { type: "MethodDefinition", accessibility: "public", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "c", + optional: false, range: [1100, 1101], loc: { @@ -2415,6 +2681,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -2430,6 +2697,7 @@ Program { end: { column: 15, line: 75 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -2452,9 +2720,12 @@ Program { type: "MethodDefinition", accessibility: "protected", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "d", + optional: false, range: [1120, 1121], loc: { @@ -2463,6 +2734,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -2476,9 +2748,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [1134, 1135], loc: { @@ -2505,6 +2780,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [1130, 1144], @@ -2521,6 +2797,7 @@ Program { end: { column: 3, line: 78 }, }, }, + declare: false, expression: false, generator: true, id: null, @@ -2547,9 +2824,13 @@ Program { end: { column: 1, line: 79 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "C", + optional: false, range: [1041, 1042], loc: { @@ -2562,7 +2843,9 @@ Program { type: "TSClassImplements", expression: Identifier { type: "Identifier", + decorators: Array [], name: "X", + optional: false, range: [1054, 1055], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/5-AST-Alignment-AST.shot index 8563a77d1a3..6847fb73212 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/keyword-variables/snapshots/5-AST-Alignment-AST.shot @@ -16,9 +16,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'abstract', +- optional: false, range: [83, 91], loc: { @@ -45,6 +48,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [77, 96], @@ -58,9 +62,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'as', +- optional: false, range: [105, 107], loc: { @@ -87,6 +94,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [99, 112], @@ -100,9 +108,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'asserts', +- optional: false, range: [121, 128], loc: { @@ -129,6 +140,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [115, 133], @@ -142,9 +154,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'any', +- optional: false, range: [142, 145], loc: { @@ -171,6 +186,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [136, 150], @@ -184,9 +200,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'async', +- optional: false, range: [159, 164], loc: { @@ -213,6 +232,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [153, 169], @@ -226,9 +246,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'await', +- optional: false, range: [178, 183], loc: { @@ -255,6 +278,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [172, 188], @@ -268,9 +292,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'boolean', +- optional: false, range: [197, 204], loc: { @@ -297,6 +324,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [191, 209], @@ -310,9 +338,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [218, 229], loc: { @@ -339,6 +370,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [212, 234], @@ -352,9 +384,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'declare', +- optional: false, range: [243, 250], loc: { @@ -381,6 +416,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [237, 255], @@ -394,9 +430,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'get', +- optional: false, range: [264, 267], loc: { @@ -423,6 +462,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [258, 272], @@ -436,9 +476,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'infer', +- optional: false, range: [281, 286], loc: { @@ -465,6 +508,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [275, 291], @@ -478,9 +522,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'is', +- optional: false, range: [300, 302], loc: { @@ -507,6 +554,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [294, 307], @@ -520,9 +568,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'keyof', +- optional: false, range: [316, 321], loc: { @@ -549,6 +600,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [310, 326], @@ -562,9 +614,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'module', +- optional: false, range: [335, 341], loc: { @@ -591,6 +646,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [329, 346], @@ -604,9 +660,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'namespace', +- optional: false, range: [355, 364], loc: { @@ -633,6 +692,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [349, 369], @@ -646,9 +706,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'never', +- optional: false, range: [378, 383], loc: { @@ -675,6 +738,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [372, 388], @@ -688,9 +752,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'readonly', +- optional: false, range: [397, 405], loc: { @@ -717,6 +784,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [391, 410], @@ -730,9 +798,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'require', +- optional: false, range: [419, 426], loc: { @@ -759,6 +830,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [413, 431], @@ -772,9 +844,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'number', +- optional: false, range: [440, 446], loc: { @@ -801,6 +876,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [434, 451], @@ -814,9 +890,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'object', +- optional: false, range: [460, 466], loc: { @@ -843,6 +922,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [454, 471], @@ -856,9 +936,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'set', +- optional: false, range: [480, 483], loc: { @@ -885,6 +968,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [474, 488], @@ -898,9 +982,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'string', +- optional: false, range: [497, 503], loc: { @@ -927,6 +1014,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [491, 508], @@ -940,9 +1028,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'symbol', +- optional: false, range: [517, 523], loc: { @@ -969,6 +1060,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [511, 528], @@ -982,9 +1074,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'type', +- optional: false, range: [537, 541], loc: { @@ -1011,6 +1106,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [531, 546], @@ -1024,9 +1120,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'undefined', +- optional: false, range: [555, 564], loc: { @@ -1053,6 +1152,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [549, 569], @@ -1066,9 +1166,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'unique', +- optional: false, range: [578, 584], loc: { @@ -1095,6 +1198,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [572, 589], @@ -1108,9 +1212,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'unknown', +- optional: false, range: [598, 605], loc: { @@ -1137,6 +1244,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [592, 610], @@ -1150,9 +1258,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'from', +- optional: false, range: [619, 623], loc: { @@ -1179,6 +1290,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [613, 628], @@ -1192,9 +1304,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'global', +- optional: false, range: [637, 643], loc: { @@ -1221,6 +1336,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [631, 648], @@ -1234,9 +1350,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bigint', +- optional: false, range: [657, 663], loc: { @@ -1263,6 +1382,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [651, 668], @@ -1276,9 +1396,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'of', +- optional: false, range: [677, 679], loc: { @@ -1305,6 +1428,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'const', range: [671, 684], @@ -1341,7 +1465,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'abstract', +- optional: false, range: [699, 707], loc: { @@ -1352,7 +1478,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'abstract', +- optional: false, range: [699, 707], loc: { @@ -1371,7 +1499,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'as', +- optional: false, range: [711, 713], loc: { @@ -1382,7 +1512,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'as', +- optional: false, range: [711, 713], loc: { @@ -1401,7 +1533,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'asserts', +- optional: false, range: [717, 724], loc: { @@ -1412,7 +1546,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'asserts', +- optional: false, range: [717, 724], loc: { @@ -1431,7 +1567,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'any', +- optional: false, range: [728, 731], loc: { @@ -1442,7 +1580,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'any', +- optional: false, range: [728, 731], loc: { @@ -1461,7 +1601,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'async', +- optional: false, range: [735, 740], loc: { @@ -1472,7 +1614,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'async', +- optional: false, range: [735, 740], loc: { @@ -1491,7 +1635,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'await', +- optional: false, range: [744, 749], loc: { @@ -1502,7 +1648,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'await', +- optional: false, range: [744, 749], loc: { @@ -1521,7 +1669,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'boolean', +- optional: false, range: [753, 760], loc: { @@ -1532,7 +1682,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'boolean', +- optional: false, range: [753, 760], loc: { @@ -1551,7 +1703,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [764, 775], loc: { @@ -1562,7 +1716,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [764, 775], loc: { @@ -1581,7 +1737,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'declare', +- optional: false, range: [779, 786], loc: { @@ -1592,7 +1750,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'declare', +- optional: false, range: [779, 786], loc: { @@ -1611,7 +1771,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'get', +- optional: false, range: [790, 793], loc: { @@ -1622,7 +1784,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'get', +- optional: false, range: [790, 793], loc: { @@ -1641,7 +1805,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'infer', +- optional: false, range: [797, 802], loc: { @@ -1652,7 +1818,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'infer', +- optional: false, range: [797, 802], loc: { @@ -1671,7 +1839,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'is', +- optional: false, range: [806, 808], loc: { @@ -1682,7 +1852,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'is', +- optional: false, range: [806, 808], loc: { @@ -1701,7 +1873,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'keyof', +- optional: false, range: [812, 817], loc: { @@ -1712,7 +1886,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'keyof', +- optional: false, range: [812, 817], loc: { @@ -1731,7 +1907,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'module', +- optional: false, range: [821, 827], loc: { @@ -1742,7 +1920,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'module', +- optional: false, range: [821, 827], loc: { @@ -1761,7 +1941,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'namespace', +- optional: false, range: [831, 840], loc: { @@ -1772,7 +1954,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'namespace', +- optional: false, range: [831, 840], loc: { @@ -1791,7 +1975,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'never', +- optional: false, range: [844, 849], loc: { @@ -1802,7 +1988,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'never', +- optional: false, range: [844, 849], loc: { @@ -1821,7 +2009,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'readonly', +- optional: false, range: [853, 861], loc: { @@ -1832,7 +2022,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'readonly', +- optional: false, range: [853, 861], loc: { @@ -1851,7 +2043,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'require', +- optional: false, range: [865, 872], loc: { @@ -1862,7 +2056,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'require', +- optional: false, range: [865, 872], loc: { @@ -1881,7 +2077,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'number', +- optional: false, range: [876, 882], loc: { @@ -1892,7 +2090,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'number', +- optional: false, range: [876, 882], loc: { @@ -1911,7 +2111,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'object', +- optional: false, range: [886, 892], loc: { @@ -1922,7 +2124,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'object', +- optional: false, range: [886, 892], loc: { @@ -1941,7 +2145,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'set', +- optional: false, range: [896, 899], loc: { @@ -1952,7 +2158,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'set', +- optional: false, range: [896, 899], loc: { @@ -1971,7 +2179,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'string', +- optional: false, range: [903, 909], loc: { @@ -1982,7 +2192,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'string', +- optional: false, range: [903, 909], loc: { @@ -2001,7 +2213,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'symbol', +- optional: false, range: [913, 919], loc: { @@ -2012,7 +2226,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'symbol', +- optional: false, range: [913, 919], loc: { @@ -2031,7 +2247,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'type', +- optional: false, range: [923, 927], loc: { @@ -2042,7 +2260,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'type', +- optional: false, range: [923, 927], loc: { @@ -2061,7 +2281,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'undefined', +- optional: false, range: [931, 940], loc: { @@ -2072,7 +2294,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'undefined', +- optional: false, range: [931, 940], loc: { @@ -2091,7 +2315,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'unique', +- optional: false, range: [944, 950], loc: { @@ -2102,7 +2328,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'unique', +- optional: false, range: [944, 950], loc: { @@ -2121,7 +2349,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'unknown', +- optional: false, range: [954, 961], loc: { @@ -2132,7 +2362,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'unknown', +- optional: false, range: [954, 961], loc: { @@ -2151,7 +2383,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'from', +- optional: false, range: [965, 969], loc: { @@ -2162,7 +2396,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'from', +- optional: false, range: [965, 969], loc: { @@ -2181,7 +2417,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'global', +- optional: false, range: [973, 979], loc: { @@ -2192,7 +2430,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'global', +- optional: false, range: [973, 979], loc: { @@ -2211,7 +2451,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bigint', +- optional: false, range: [983, 989], loc: { @@ -2222,7 +2464,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bigint', +- optional: false, range: [983, 989], loc: { @@ -2241,7 +2485,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'ImportSpecifier', imported: Identifier { type: 'Identifier', +- decorators: Array [], name: 'of', +- optional: false, range: [993, 995], loc: { @@ -2252,7 +2498,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A importKind: 'value', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'of', +- optional: false, range: [993, 995], loc: { @@ -2287,9 +2535,13 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A end: { column: 14, line: 71 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [1030, 1031], loc: { @@ -2306,15 +2558,19 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [1067, 1068], loc: { @@ -2323,6 +2579,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: true, value: FunctionExpression { @@ -2338,6 +2595,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A end: { column: 15, line: 73 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -2360,9 +2618,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'MethodDefinition', accessibility: 'private', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [1084, 1085], loc: { @@ -2371,6 +2632,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -2386,6 +2648,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A end: { column: 16, line: 74 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -2408,9 +2671,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'MethodDefinition', accessibility: 'public', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'c', +- optional: false, range: [1100, 1101], loc: { @@ -2419,6 +2685,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -2434,6 +2701,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A end: { column: 15, line: 75 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -2456,9 +2724,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A type: 'MethodDefinition', accessibility: 'protected', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'd', +- optional: false, range: [1120, 1121], loc: { @@ -2467,6 +2738,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -2480,9 +2752,12 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, range: [1134, 1135], loc: { @@ -2509,6 +2784,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A }, }, ], +- declare: false, kind: 'let', range: [1130, 1144], @@ -2525,6 +2801,7 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A end: { column: 3, line: 78 }, }, }, +- declare: false, expression: false, generator: true, id: null, @@ -2551,9 +2828,13 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A end: { column: 1, line: 79 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [1041, 1042], loc: { @@ -2568,7 +2849,9 @@ exports[`AST Fixtures legacy-fixtures basics keyword-variables AST Alignment - A + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [1054, 1055], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/1-TSESTree-AST.shot index 7cc4d89ca0c..602764aad98 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "nestedArray", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { @@ -48,7 +51,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Array", + optional: false, range: [102, 107], loc: { @@ -93,7 +98,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Array", + optional: false, range: [96, 101], loc: { @@ -128,7 +135,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Array", + optional: false, range: [102, 107], loc: { @@ -188,7 +197,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Array", + optional: false, range: [90, 95], loc: { @@ -228,7 +239,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Array", + optional: false, range: [102, 107], loc: { @@ -273,7 +286,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Array", + optional: false, range: [96, 101], loc: { @@ -308,7 +323,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Array", + optional: false, range: [102, 107], loc: { @@ -396,6 +413,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [73, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/5-AST-Alignment-AST.shot index 7813a45fd01..81ea3c385c7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nested-type-arguments/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures basics nested-type-arguments AST Alignment declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'nestedArray', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { @@ -52,7 +55,9 @@ exports[`AST Fixtures legacy-fixtures basics nested-type-arguments AST Alignment - }, - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'Array', +- optional: false, - - range: [102, 107], - loc: { @@ -97,7 +102,9 @@ exports[`AST Fixtures legacy-fixtures basics nested-type-arguments AST Alignment - }, - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'Array', +- optional: false, - - range: [96, 101], - loc: { @@ -132,7 +139,9 @@ exports[`AST Fixtures legacy-fixtures basics nested-type-arguments AST Alignment - }, - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'Array', +- optional: false, - - range: [102, 107], - loc: { @@ -192,7 +201,9 @@ exports[`AST Fixtures legacy-fixtures basics nested-type-arguments AST Alignment - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Array', +- optional: false, range: [90, 95], loc: { @@ -232,7 +243,9 @@ exports[`AST Fixtures legacy-fixtures basics nested-type-arguments AST Alignment - }, - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'Array', +- optional: false, - - range: [102, 107], - loc: { @@ -277,7 +290,9 @@ exports[`AST Fixtures legacy-fixtures basics nested-type-arguments AST Alignment - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Array', +- optional: false, range: [96, 101], loc: { @@ -312,7 +327,9 @@ exports[`AST Fixtures legacy-fixtures basics nested-type-arguments AST Alignment - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Array', +- optional: false, range: [102, 107], loc: { @@ -400,6 +417,7 @@ exports[`AST Fixtures legacy-fixtures basics nested-type-arguments AST Alignment }, }, ], +- declare: false, kind: 'var', range: [73, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/1-TSESTree-AST.shot index 97820a6e6d8..e69bdd18a83 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { @@ -38,7 +41,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "X", + optional: false, range: [80, 81], loc: { @@ -96,6 +101,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [73, 89], @@ -114,7 +120,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "Observable", + optional: false, range: [90, 100], loc: { @@ -125,7 +133,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "empty", + optional: false, range: [101, 106], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/5-AST-Alignment-AST.shot index 718e34a1d42..455668676a7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/never-type-param/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures basics never-type-param AST Alignment - AS declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { @@ -42,7 +45,9 @@ exports[`AST Fixtures legacy-fixtures basics never-type-param AST Alignment - AS - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [80, 81], loc: { @@ -100,6 +105,7 @@ exports[`AST Fixtures legacy-fixtures basics never-type-param AST Alignment - AS }, }, ], +- declare: false, kind: 'var', range: [73, 89], @@ -118,7 +124,9 @@ exports[`AST Fixtures legacy-fixtures basics never-type-param AST Alignment - AS computed: false, object: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Observable', +- optional: false, range: [90, 100], loc: { @@ -129,7 +137,9 @@ exports[`AST Fixtures legacy-fixtures basics never-type-param AST Alignment - AS optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'empty', +- optional: false, range: [101, 106], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/non-null-assertion-operator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/non-null-assertion-operator/snapshots/1-TSESTree-AST.shot index 70afb98ceaf..b000083c6f2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/non-null-assertion-operator/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/non-null-assertion-operator/snapshots/1-TSESTree-AST.shot @@ -17,7 +17,9 @@ Program { arguments: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "e", + optional: false, range: [127, 128], loc: { @@ -28,7 +30,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: Array [], name: "validateEntity", + optional: false, range: [112, 126], loc: { @@ -56,9 +60,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "s", + optional: false, range: [137, 138], loc: { @@ -73,7 +80,9 @@ Program { type: "TSNonNullExpression", expression: Identifier { type: "Identifier", + decorators: Array [], name: "e", + optional: false, range: [141, 142], loc: { @@ -91,7 +100,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "name", + optional: false, range: [144, 148], loc: { @@ -114,6 +125,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [133, 149], @@ -130,11 +142,14 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "processEntity", + optional: false, range: [82, 95], loc: { @@ -145,6 +160,7 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "e", optional: true, typeAnnotation: TSTypeAnnotation { @@ -153,7 +169,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Entity", + optional: false, range: [100, 106], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/non-null-assertion-operator/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/non-null-assertion-operator/snapshots/5-AST-Alignment-AST.shot index d8601d44284..552644a251b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/non-null-assertion-operator/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/non-null-assertion-operator/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,223 @@ exports[`AST Fixtures legacy-fixtures basics non-null-assertion-operator AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'e', +- optional: false, + + range: [127, 128], + loc: { + start: { column: 17, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + ], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'validateEntity', +- optional: false, + + range: [112, 126], + loc: { + start: { column: 2, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + optional: false, + + range: [112, 129], + loc: { + start: { column: 2, line: 4 }, + end: { column: 19, line: 4 }, + }, + }, + + range: [112, 130], + loc: { + start: { column: 2, line: 4 }, + end: { column: 20, line: 4 }, + }, + }, + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 's', +- optional: false, + + range: [137, 138], + loc: { + start: { column: 6, line: 5 }, + end: { column: 7, line: 5 }, + }, + }, + init: MemberExpression { + type: 'MemberExpression', + computed: false, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'e', +- optional: false, + + range: [141, 142], + loc: { + start: { column: 10, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + + range: [141, 143], + loc: { + start: { column: 10, line: 5 }, + end: { column: 12, line: 5 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'name', +- optional: false, + + range: [144, 148], + loc: { + start: { column: 13, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + + range: [141, 148], + loc: { + start: { column: 10, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + + range: [137, 148], + loc: { + start: { column: 6, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [133, 149], + loc: { + start: { column: 2, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + ], + + range: [108, 151], + loc: { + start: { column: 35, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processEntity', +- optional: false, + + range: [82, 95], + loc: { + start: { column: 9, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'e', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Entity', +- optional: false, + + range: [100, 106], + loc: { + start: { column: 27, line: 3 }, + end: { column: 33, line: 3 }, + }, + }, + + range: [100, 106], + loc: { + start: { column: 27, line: 3 }, + end: { column: 33, line: 3 }, + }, + }, + + range: [98, 106], + loc: { + start: { column: 25, line: 3 }, + end: { column: 33, line: 3 }, + }, + }, + + range: [96, 106], + loc: { + start: { column: 23, line: 3 }, + end: { column: 33, line: 3 }, + }, + }, + ], + + range: [73, 151], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 152], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 7 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/1-TSESTree-AST.shot index f37ac8a2e42..c860ea6dd67 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNullKeyword { @@ -46,6 +49,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 85], @@ -59,9 +63,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "y", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUndefinedKeyword { @@ -96,6 +103,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [86, 103], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/5-AST-Alignment-AST.shot index 24b8986179c..80f91407215 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,127 @@ exports[`AST Fixtures legacy-fixtures basics null-and-undefined-type-annotations AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSNullKeyword { + type: 'TSNullKeyword', + + range: [80, 84], + loc: { + start: { column: 7, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + + range: [78, 84], + loc: { + start: { column: 5, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + + range: [77, 84], + loc: { + start: { column: 4, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + init: null, + + range: [77, 84], + loc: { + start: { column: 4, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 85], + loc: { + start: { column: 0, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'y', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSUndefinedKeyword { + type: 'TSUndefinedKeyword', + + range: [93, 102], + loc: { + start: { column: 7, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + + range: [91, 102], + loc: { + start: { column: 5, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + + range: [90, 102], + loc: { + start: { column: 4, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + init: null, + + range: [90, 102], + loc: { + start: { column: 4, line: 4 }, + end: { column: 16, line: 4 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [86, 103], + loc: { + start: { column: 0, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 104], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nullish-coalescing/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nullish-coalescing/snapshots/1-TSESTree-AST.shot index 5d1c14376fe..94cbf2d6256 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nullish-coalescing/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nullish-coalescing/snapshots/1-TSESTree-AST.shot @@ -15,9 +15,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "len", + optional: false, range: [125, 128], loc: { @@ -29,7 +32,9 @@ Program { type: "LogicalExpression", left: Identifier { type: "Identifier", + decorators: Array [], name: "s", + optional: false, range: [131, 132], loc: { @@ -64,6 +69,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [121, 139], @@ -80,11 +86,14 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "processNullishCoalesce", + optional: false, range: [82, 104], loc: { @@ -95,6 +104,7 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "s", optional: true, typeAnnotation: TSTypeAnnotation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nullish-coalescing/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nullish-coalescing/snapshots/5-AST-Alignment-AST.shot index e44cc1eb21f..c38fb1f05ff 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nullish-coalescing/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/nullish-coalescing/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,155 @@ exports[`AST Fixtures legacy-fixtures basics nullish-coalescing AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'len', +- optional: false, + + range: [125, 128], + loc: { + start: { column: 6, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + init: LogicalExpression { + type: 'LogicalExpression', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 's', +- optional: false, + + range: [131, 132], + loc: { + start: { column: 12, line: 4 }, + end: { column: 13, line: 4 }, + }, + }, + operator: '??', + right: Literal { + type: 'Literal', + raw: '\\\\'\\\\'', + value: '', + + range: [136, 138], + loc: { + start: { column: 17, line: 4 }, + end: { column: 19, line: 4 }, + }, + }, + + range: [131, 138], + loc: { + start: { column: 12, line: 4 }, + end: { column: 19, line: 4 }, + }, + }, + + range: [125, 138], + loc: { + start: { column: 6, line: 4 }, + end: { column: 19, line: 4 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [121, 139], + loc: { + start: { column: 2, line: 4 }, + end: { column: 20, line: 4 }, + }, + }, + ], + + range: [117, 141], + loc: { + start: { column: 44, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processNullishCoalesce', +- optional: false, + + range: [82, 104], + loc: { + start: { column: 9, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 's', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [109, 115], + loc: { + start: { column: 36, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + + range: [107, 115], + loc: { + start: { column: 34, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + + range: [105, 115], + loc: { + start: { column: 32, line: 3 }, + end: { column: 42, line: 3 }, + }, + }, + ], + + range: [73, 141], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 142], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/1-TSESTree-AST.shot index 2942241b82c..0b7af54ba24 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "__", + optional: false, range: [76, 78], loc: { @@ -24,6 +26,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: Literal { type: "Literal", @@ -68,7 +71,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "__", + optional: false, range: [93, 95], loc: { @@ -78,6 +83,7 @@ Program { }, kind: "init", method: true, + optional: false, shorthand: false, value: FunctionExpression { type: "FunctionExpression", @@ -92,6 +98,7 @@ Program { end: { column: 10, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -146,6 +153,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: Literal { type: "Literal", @@ -182,6 +190,7 @@ Program { }, ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -189,6 +198,8 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: Literal { type: "Literal", raw: "'__'", @@ -200,7 +211,9 @@ Program { end: { column: 6, line: 10 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: Literal { type: "Literal", @@ -228,9 +241,13 @@ Program { end: { column: 1, line: 11 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "X", + optional: false, range: [133, 134], loc: { @@ -238,6 +255,7 @@ Program { end: { column: 7, line: 9 }, }, }, + implements: Array [], superClass: null, range: [127, 153], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/5-AST-Alignment-AST.shot index 5d16eed4a91..669bf7d45eb 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-escaped-properties/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: '__', +- optional: false, range: [76, 78], loc: { @@ -28,6 +30,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST }, kind: 'init', method: false, +- optional: false, shorthand: false, value: Literal { type: 'Literal', @@ -72,7 +75,9 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: '__', +- optional: false, range: [93, 95], loc: { @@ -82,6 +87,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST }, kind: 'init', method: true, +- optional: false, shorthand: false, value: FunctionExpression { type: 'FunctionExpression', @@ -96,6 +102,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST end: { column: 10, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -150,6 +157,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST }, kind: 'init', method: false, +- optional: false, shorthand: false, value: Literal { type: 'Literal', @@ -186,6 +194,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST }, ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -193,6 +202,8 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Literal { type: 'Literal', raw: '\\\\'__\\\\'', @@ -204,7 +215,9 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST end: { column: 6, line: 10 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: Literal { type: 'Literal', @@ -232,9 +245,13 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST end: { column: 1, line: 11 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [133, 134], loc: { @@ -242,6 +259,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-escaped-properties AST end: { column: 7, line: 9 }, }, }, +- implements: Array [], superClass: null, range: [127, 153], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-typed-methods/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-typed-methods/snapshots/1-TSESTree-AST.shot index e8f81ec7e88..52febec049c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-typed-methods/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-typed-methods/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [79, 82], loc: { @@ -27,7 +30,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "constructor", + optional: false, range: [89, 100], loc: { @@ -37,6 +42,7 @@ Program { }, kind: "init", method: true, + optional: false, shorthand: false, value: FunctionExpression { type: "FunctionExpression", @@ -72,6 +78,7 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -102,7 +109,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [101, 102], loc: { @@ -145,7 +154,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [137, 140], loc: { @@ -155,6 +166,7 @@ Program { }, kind: "init", method: true, + optional: false, shorthand: false, value: FunctionExpression { type: "FunctionExpression", @@ -190,6 +202,7 @@ Program { end: { column: 3, line: 9 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -220,7 +233,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [141, 142], loc: { @@ -263,7 +278,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [181, 182], loc: { @@ -273,6 +290,7 @@ Program { }, kind: "get", method: false, + optional: false, shorthand: false, value: FunctionExpression { type: "FunctionExpression", @@ -308,6 +326,7 @@ Program { end: { column: 3, line: 12 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -349,7 +368,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [220, 221], loc: { @@ -359,6 +380,7 @@ Program { }, kind: "set", method: false, + optional: false, shorthand: false, value: FunctionExpression { type: "FunctionExpression", @@ -373,13 +395,16 @@ Program { end: { column: 29, line: 13 }, }, }, + declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -454,6 +479,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [73, 247], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-typed-methods/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-typed-methods/snapshots/5-AST-Alignment-AST.shot index 6dce128496d..99d022a2158 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-typed-methods/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/object-with-typed-methods/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [79, 82], loc: { @@ -31,7 +34,9 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [89, 100], loc: { @@ -41,6 +46,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align }, kind: 'init', method: true, +- optional: false, shorthand: false, + typeParameters: TSTypeParameterDeclaration { + type: 'TSTypeParameterDeclaration', @@ -97,6 +103,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align end: { column: 3, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -117,8 +124,8 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align loc: { start: { column: 18, line: 4 }, end: { column: 26, line: 4 }, - }, - }, +- }, +- }, - typeParameters: TSTypeParameterDeclaration { - type: 'TSTypeParameterDeclaration', - params: Array [ @@ -127,8 +134,10 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', - +- optional: false, +- - range: [101, 102], - loc: { - start: { column: 14, line: 4 }, @@ -149,9 +158,9 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align - loc: { - start: { column: 13, line: 4 }, - end: { column: 16, line: 4 }, -- }, -- }, -- + }, + }, + - range: [100, 133], + range: [103, 133], loc: { @@ -172,7 +181,9 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [137, 140], loc: { @@ -182,6 +193,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align }, kind: 'init', method: true, +- optional: false, shorthand: false, + typeParameters: TSTypeParameterDeclaration { + type: 'TSTypeParameterDeclaration', @@ -238,6 +250,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align end: { column: 3, line: 9 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -258,8 +271,8 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align loc: { start: { column: 10, line: 7 }, end: { column: 18, line: 7 }, -- }, -- }, + }, + }, - typeParameters: TSTypeParameterDeclaration { - type: 'TSTypeParameterDeclaration', - params: Array [ @@ -268,8 +281,10 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', -- +- optional: false, + - range: [141, 142], - loc: { - start: { column: 6, line: 7 }, @@ -290,9 +305,9 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align - loc: { - start: { column: 5, line: 7 }, - end: { column: 8, line: 7 }, - }, - }, - +- }, +- }, +- - range: [140, 173], + range: [143, 173], loc: { @@ -313,7 +328,9 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [181, 182], loc: { @@ -323,6 +340,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align }, kind: 'get', method: false, +- optional: false, shorthand: false, value: FunctionExpression { type: 'FunctionExpression', @@ -358,6 +376,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align end: { column: 3, line: 12 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -399,7 +418,9 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [220, 221], loc: { @@ -409,6 +430,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align }, kind: 'set', method: false, +- optional: false, shorthand: false, value: FunctionExpression { type: 'FunctionExpression', @@ -423,13 +445,16 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align end: { column: 29, line: 13 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -504,6 +529,7 @@ exports[`AST Fixtures legacy-fixtures basics object-with-typed-methods AST Align }, }, ], +- declare: false, kind: 'const', range: [73, 247], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-non-null-assertion/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-non-null-assertion/snapshots/1-TSESTree-AST.shot index a445931c44c..c6b7adf9fff 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-non-null-assertion/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-non-null-assertion/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [113, 116], loc: { @@ -35,7 +37,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [118, 121], loc: { @@ -96,7 +100,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [128, 131], loc: { @@ -107,7 +113,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [133, 136], loc: { @@ -132,7 +140,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [138, 143], loc: { @@ -183,7 +193,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [149, 152], loc: { @@ -194,7 +206,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [154, 157], loc: { @@ -255,7 +269,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [164, 167], loc: { @@ -266,7 +282,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [169, 172], loc: { @@ -291,7 +309,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [174, 179], loc: { @@ -342,7 +362,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [185, 188], loc: { @@ -353,7 +375,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [190, 193], loc: { @@ -414,7 +438,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [200, 203], loc: { @@ -425,7 +451,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [205, 208], loc: { @@ -450,7 +478,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [210, 215], loc: { @@ -495,11 +525,14 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "processOptional", + optional: false, range: [82, 97], loc: { @@ -510,6 +543,7 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "one", optional: true, typeAnnotation: TSTypeAnnotation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot index 6356986bf83..57486acf58b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,594 @@ exports[`AST Fixtures legacy-fixtures basics optional-chain-call-with-non-null-assertion AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [113, 116], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [118, 121], + loc: { + start: { column: 7, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [113, 121], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [113, 122], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + optional: false, + + range: [113, 124], + loc: { + start: { column: 2, line: 4 }, + end: { column: 13, line: 4 }, + }, + }, + + range: [113, 124], + loc: { + start: { column: 2, line: 4 }, + end: { column: 13, line: 4 }, + }, + }, + + range: [113, 125], + loc: { + start: { column: 2, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [128, 131], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [133, 136], + loc: { + start: { column: 7, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + + range: [128, 136], + loc: { + start: { column: 2, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + + range: [128, 137], + loc: { + start: { column: 2, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [138, 143], + loc: { + start: { column: 12, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + + range: [128, 143], + loc: { + start: { column: 2, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + optional: false, + + range: [128, 145], + loc: { + start: { column: 2, line: 5 }, + end: { column: 19, line: 5 }, + }, + }, + + range: [128, 145], + loc: { + start: { column: 2, line: 5 }, + end: { column: 19, line: 5 }, + }, + }, + + range: [128, 146], + loc: { + start: { column: 2, line: 5 }, + end: { column: 20, line: 5 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [149, 152], + loc: { + start: { column: 2, line: 6 }, + end: { column: 5, line: 6 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [154, 157], + loc: { + start: { column: 7, line: 6 }, + end: { column: 10, line: 6 }, + }, + }, + + range: [149, 157], + loc: { + start: { column: 2, line: 6 }, + end: { column: 10, line: 6 }, + }, + }, + + range: [149, 158], + loc: { + start: { column: 2, line: 6 }, + end: { column: 11, line: 6 }, + }, + }, + optional: false, + + range: [149, 160], + loc: { + start: { column: 2, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + + range: [149, 160], + loc: { + start: { column: 2, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + + range: [149, 161], + loc: { + start: { column: 2, line: 6 }, + end: { column: 14, line: 6 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [164, 167], + loc: { + start: { column: 2, line: 7 }, + end: { column: 5, line: 7 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [169, 172], + loc: { + start: { column: 7, line: 7 }, + end: { column: 10, line: 7 }, + }, + }, + + range: [164, 172], + loc: { + start: { column: 2, line: 7 }, + end: { column: 10, line: 7 }, + }, + }, + + range: [164, 173], + loc: { + start: { column: 2, line: 7 }, + end: { column: 11, line: 7 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [174, 179], + loc: { + start: { column: 12, line: 7 }, + end: { column: 17, line: 7 }, + }, + }, + + range: [164, 179], + loc: { + start: { column: 2, line: 7 }, + end: { column: 17, line: 7 }, + }, + }, + optional: false, + + range: [164, 181], + loc: { + start: { column: 2, line: 7 }, + end: { column: 19, line: 7 }, + }, + }, + + range: [164, 181], + loc: { + start: { column: 2, line: 7 }, + end: { column: 19, line: 7 }, + }, + }, + + range: [164, 182], + loc: { + start: { column: 2, line: 7 }, + end: { column: 20, line: 7 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [185, 188], + loc: { + start: { column: 2, line: 8 }, + end: { column: 5, line: 8 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [190, 193], + loc: { + start: { column: 7, line: 8 }, + end: { column: 10, line: 8 }, + }, + }, + + range: [185, 193], + loc: { + start: { column: 2, line: 8 }, + end: { column: 10, line: 8 }, + }, + }, + + range: [185, 194], + loc: { + start: { column: 2, line: 8 }, + end: { column: 11, line: 8 }, + }, + }, + optional: false, + + range: [185, 196], + loc: { + start: { column: 2, line: 8 }, + end: { column: 13, line: 8 }, + }, + }, + + range: [185, 196], + loc: { + start: { column: 2, line: 8 }, + end: { column: 13, line: 8 }, + }, + }, + + range: [185, 197], + loc: { + start: { column: 2, line: 8 }, + end: { column: 14, line: 8 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [200, 203], + loc: { + start: { column: 2, line: 9 }, + end: { column: 5, line: 9 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [205, 208], + loc: { + start: { column: 7, line: 9 }, + end: { column: 10, line: 9 }, + }, + }, + + range: [200, 208], + loc: { + start: { column: 2, line: 9 }, + end: { column: 10, line: 9 }, + }, + }, + + range: [200, 209], + loc: { + start: { column: 2, line: 9 }, + end: { column: 11, line: 9 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [210, 215], + loc: { + start: { column: 12, line: 9 }, + end: { column: 17, line: 9 }, + }, + }, + + range: [200, 215], + loc: { + start: { column: 2, line: 9 }, + end: { column: 17, line: 9 }, + }, + }, + optional: false, + + range: [200, 217], + loc: { + start: { column: 2, line: 9 }, + end: { column: 19, line: 9 }, + }, + }, + + range: [200, 217], + loc: { + start: { column: 2, line: 9 }, + end: { column: 19, line: 9 }, + }, + }, + + range: [200, 218], + loc: { + start: { column: 2, line: 9 }, + end: { column: 20, line: 9 }, + }, + }, + ], + + range: [109, 220], + loc: { + start: { column: 36, line: 3 }, + end: { column: 1, line: 10 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processOptional', +- optional: false, + + range: [82, 97], + loc: { + start: { column: 9, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [104, 107], + loc: { + start: { column: 31, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [102, 107], + loc: { + start: { column: 29, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [98, 107], + loc: { + start: { column: 25, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + ], + + range: [73, 220], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 10 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 221], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 11 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-parens/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-parens/snapshots/1-TSESTree-AST.shot index c7bb252b484..e7578c7953c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-parens/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-parens/snapshots/1-TSESTree-AST.shot @@ -22,7 +22,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [123, 126], loc: { @@ -33,7 +35,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "fn", + optional: false, range: [128, 130], loc: { @@ -85,7 +89,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [137, 140], loc: { @@ -96,7 +102,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [142, 145], loc: { @@ -121,7 +129,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "fn", + optional: false, range: [147, 149], loc: { @@ -166,7 +176,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [155, 158], loc: { @@ -177,7 +189,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [159, 162], loc: { @@ -195,7 +209,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "fn", + optional: false, range: [164, 166], loc: { @@ -250,7 +266,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [173, 176], loc: { @@ -261,7 +279,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [177, 180], loc: { @@ -279,7 +299,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [182, 187], loc: { @@ -304,7 +326,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "fn", + optional: false, range: [189, 191], loc: { @@ -352,7 +376,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [197, 200], loc: { @@ -363,7 +389,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [201, 204], loc: { @@ -381,7 +409,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [206, 211], loc: { @@ -399,7 +429,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "fn", + optional: false, range: [213, 215], loc: { @@ -445,7 +477,9 @@ Program { arguments: Array [], callee: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [222, 225], loc: { @@ -487,7 +521,9 @@ Program { arguments: Array [], callee: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [234, 237], loc: { @@ -537,7 +573,9 @@ Program { arguments: Array [], callee: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [248, 251], loc: { @@ -587,7 +625,9 @@ Program { arguments: Array [], callee: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [265, 268], loc: { @@ -613,7 +653,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [274, 277], loc: { @@ -643,11 +685,14 @@ Program { end: { column: 1, line: 15 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "processOptionalCallParens", + optional: false, range: [82, 107], loc: { @@ -658,6 +703,7 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "one", optional: true, typeAnnotation: TSTypeAnnotation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-parens/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-parens/snapshots/5-AST-Alignment-AST.shot index 0227f0b9ac0..484e493aab8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-parens/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call-with-parens/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,754 @@ exports[`AST Fixtures legacy-fixtures basics optional-chain-call-with-parens AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [123, 126], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fn', +- optional: false, + + range: [128, 130], + loc: { + start: { column: 7, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + + range: [123, 130], + loc: { + start: { column: 2, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + optional: false, + + range: [123, 132], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + + range: [123, 132], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + + range: [123, 133], + loc: { + start: { column: 2, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [137, 140], + loc: { + start: { column: 3, line: 5 }, + end: { column: 6, line: 5 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [142, 145], + loc: { + start: { column: 8, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + + range: [137, 145], + loc: { + start: { column: 3, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + + range: [137, 145], + loc: { + start: { column: 3, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fn', +- optional: false, + + range: [147, 149], + loc: { + start: { column: 13, line: 5 }, + end: { column: 15, line: 5 }, + }, + }, + + range: [136, 149], + loc: { + start: { column: 2, line: 5 }, + end: { column: 15, line: 5 }, + }, + }, + optional: false, + + range: [136, 151], + loc: { + start: { column: 2, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + + range: [136, 152], + loc: { + start: { column: 2, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [155, 158], + loc: { + start: { column: 2, line: 6 }, + end: { column: 5, line: 6 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [159, 162], + loc: { + start: { column: 6, line: 6 }, + end: { column: 9, line: 6 }, + }, + }, + + range: [155, 162], + loc: { + start: { column: 2, line: 6 }, + end: { column: 9, line: 6 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fn', +- optional: false, + + range: [164, 166], + loc: { + start: { column: 11, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + + range: [155, 166], + loc: { + start: { column: 2, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + optional: false, + + range: [155, 168], + loc: { + start: { column: 2, line: 6 }, + end: { column: 15, line: 6 }, + }, + }, + + range: [155, 168], + loc: { + start: { column: 2, line: 6 }, + end: { column: 15, line: 6 }, + }, + }, + + range: [155, 169], + loc: { + start: { column: 2, line: 6 }, + end: { column: 16, line: 6 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [173, 176], + loc: { + start: { column: 3, line: 7 }, + end: { column: 6, line: 7 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [177, 180], + loc: { + start: { column: 7, line: 7 }, + end: { column: 10, line: 7 }, + }, + }, + + range: [173, 180], + loc: { + start: { column: 3, line: 7 }, + end: { column: 10, line: 7 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [182, 187], + loc: { + start: { column: 12, line: 7 }, + end: { column: 17, line: 7 }, + }, + }, + + range: [173, 187], + loc: { + start: { column: 3, line: 7 }, + end: { column: 17, line: 7 }, + }, + }, + + range: [173, 187], + loc: { + start: { column: 3, line: 7 }, + end: { column: 17, line: 7 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fn', +- optional: false, + + range: [189, 191], + loc: { + start: { column: 19, line: 7 }, + end: { column: 21, line: 7 }, + }, + }, + + range: [172, 191], + loc: { + start: { column: 2, line: 7 }, + end: { column: 21, line: 7 }, + }, + }, + optional: false, + + range: [172, 193], + loc: { + start: { column: 2, line: 7 }, + end: { column: 23, line: 7 }, + }, + }, + + range: [172, 194], + loc: { + start: { column: 2, line: 7 }, + end: { column: 24, line: 7 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [197, 200], + loc: { + start: { column: 2, line: 8 }, + end: { column: 5, line: 8 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [201, 204], + loc: { + start: { column: 6, line: 8 }, + end: { column: 9, line: 8 }, + }, + }, + + range: [197, 204], + loc: { + start: { column: 2, line: 8 }, + end: { column: 9, line: 8 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [206, 211], + loc: { + start: { column: 11, line: 8 }, + end: { column: 16, line: 8 }, + }, + }, + + range: [197, 211], + loc: { + start: { column: 2, line: 8 }, + end: { column: 16, line: 8 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fn', +- optional: false, + + range: [213, 215], + loc: { + start: { column: 18, line: 8 }, + end: { column: 20, line: 8 }, + }, + }, + + range: [197, 215], + loc: { + start: { column: 2, line: 8 }, + end: { column: 20, line: 8 }, + }, + }, + optional: false, + + range: [197, 217], + loc: { + start: { column: 2, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [197, 217], + loc: { + start: { column: 2, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [197, 218], + loc: { + start: { column: 2, line: 8 }, + end: { column: 23, line: 8 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [222, 225], + loc: { + start: { column: 2, line: 10 }, + end: { column: 5, line: 10 }, + }, + }, + optional: true, + + range: [222, 229], + loc: { + start: { column: 2, line: 10 }, + end: { column: 9, line: 10 }, + }, + }, + + range: [222, 229], + loc: { + start: { column: 2, line: 10 }, + end: { column: 9, line: 10 }, + }, + }, + + range: [222, 230], + loc: { + start: { column: 2, line: 10 }, + end: { column: 10, line: 10 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [234, 237], + loc: { + start: { column: 3, line: 11 }, + end: { column: 6, line: 11 }, + }, + }, + optional: true, + + range: [234, 241], + loc: { + start: { column: 3, line: 11 }, + end: { column: 10, line: 11 }, + }, + }, + + range: [234, 241], + loc: { + start: { column: 3, line: 11 }, + end: { column: 10, line: 11 }, + }, + }, + optional: false, + + range: [233, 244], + loc: { + start: { column: 2, line: 11 }, + end: { column: 13, line: 11 }, + }, + }, + + range: [233, 245], + loc: { + start: { column: 2, line: 11 }, + end: { column: 14, line: 11 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [248, 251], + loc: { + start: { column: 2, line: 12 }, + end: { column: 5, line: 12 }, + }, + }, + optional: true, + + range: [248, 255], + loc: { + start: { column: 2, line: 12 }, + end: { column: 9, line: 12 }, + }, + }, + optional: true, + + range: [248, 259], + loc: { + start: { column: 2, line: 12 }, + end: { column: 13, line: 12 }, + }, + }, + + range: [248, 259], + loc: { + start: { column: 2, line: 12 }, + end: { column: 13, line: 12 }, + }, + }, + + range: [248, 260], + loc: { + start: { column: 2, line: 12 }, + end: { column: 14, line: 12 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [265, 268], + loc: { + start: { column: 3, line: 14 }, + end: { column: 6, line: 14 }, + }, + }, + optional: true, + + range: [265, 272], + loc: { + start: { column: 3, line: 14 }, + end: { column: 10, line: 14 }, + }, + }, + + range: [265, 272], + loc: { + start: { column: 3, line: 14 }, + end: { column: 10, line: 14 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [274, 277], + loc: { + start: { column: 12, line: 14 }, + end: { column: 15, line: 14 }, + }, + }, + + range: [264, 277], + loc: { + start: { column: 2, line: 14 }, + end: { column: 15, line: 14 }, + }, + }, + + range: [264, 278], + loc: { + start: { column: 2, line: 14 }, + end: { column: 16, line: 14 }, + }, + }, + ], + + range: [119, 280], + loc: { + start: { column: 46, line: 3 }, + end: { column: 1, line: 15 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processOptionalCallParens', +- optional: false, + + range: [82, 107], + loc: { + start: { column: 9, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [114, 117], + loc: { + start: { column: 41, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + + range: [112, 117], + loc: { + start: { column: 39, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + + range: [108, 117], + loc: { + start: { column: 35, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + ], + + range: [73, 280], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 15 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 281], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 16 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call/snapshots/1-TSESTree-AST.shot index 87b6812a00b..7272e6077c6 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call/snapshots/1-TSESTree-AST.shot @@ -22,7 +22,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [117, 120], loc: { @@ -33,7 +35,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "fn", + optional: false, range: [122, 124], loc: { @@ -85,7 +89,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [130, 133], loc: { @@ -96,7 +102,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [135, 138], loc: { @@ -114,7 +122,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "fn", + optional: false, range: [139, 141], loc: { @@ -166,7 +176,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [147, 150], loc: { @@ -177,7 +189,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [151, 154], loc: { @@ -195,7 +209,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "fn", + optional: false, range: [156, 158], loc: { @@ -250,7 +266,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [164, 167], loc: { @@ -261,7 +279,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [168, 171], loc: { @@ -279,7 +299,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [173, 178], loc: { @@ -297,7 +319,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "fn", + optional: false, range: [179, 181], loc: { @@ -352,7 +376,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [187, 190], loc: { @@ -363,7 +389,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [191, 194], loc: { @@ -381,7 +409,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [196, 201], loc: { @@ -399,7 +429,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "fn", + optional: false, range: [203, 205], loc: { @@ -445,7 +477,9 @@ Program { arguments: Array [], callee: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [212, 215], loc: { @@ -487,7 +521,9 @@ Program { arguments: Array [], callee: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [223, 226], loc: { @@ -537,7 +573,9 @@ Program { arguments: Array [], callee: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [236, 239], loc: { @@ -587,7 +625,9 @@ Program { arguments: Array [], callee: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [252, 255], loc: { @@ -606,7 +646,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [260, 263], loc: { @@ -643,11 +685,14 @@ Program { end: { column: 1, line: 15 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "processOptionalCall", + optional: false, range: [82, 101], loc: { @@ -658,6 +703,7 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "one", optional: true, typeAnnotation: TSTypeAnnotation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call/snapshots/5-AST-Alignment-AST.shot index 46ac1db8b24..ca3abed0463 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-call/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,754 @@ exports[`AST Fixtures legacy-fixtures basics optional-chain-call AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [117, 120], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fn', +- optional: false, + + range: [122, 124], + loc: { + start: { column: 7, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + + range: [117, 124], + loc: { + start: { column: 2, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + optional: false, + + range: [117, 126], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + + range: [117, 126], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + + range: [117, 127], + loc: { + start: { column: 2, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [130, 133], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [135, 138], + loc: { + start: { column: 7, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + + range: [130, 138], + loc: { + start: { column: 2, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fn', +- optional: false, + + range: [139, 141], + loc: { + start: { column: 11, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, + + range: [130, 141], + loc: { + start: { column: 2, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, + optional: false, + + range: [130, 143], + loc: { + start: { column: 2, line: 5 }, + end: { column: 15, line: 5 }, + }, + }, + + range: [130, 143], + loc: { + start: { column: 2, line: 5 }, + end: { column: 15, line: 5 }, + }, + }, + + range: [130, 144], + loc: { + start: { column: 2, line: 5 }, + end: { column: 16, line: 5 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [147, 150], + loc: { + start: { column: 2, line: 6 }, + end: { column: 5, line: 6 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [151, 154], + loc: { + start: { column: 6, line: 6 }, + end: { column: 9, line: 6 }, + }, + }, + + range: [147, 154], + loc: { + start: { column: 2, line: 6 }, + end: { column: 9, line: 6 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fn', +- optional: false, + + range: [156, 158], + loc: { + start: { column: 11, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + + range: [147, 158], + loc: { + start: { column: 2, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + optional: false, + + range: [147, 160], + loc: { + start: { column: 2, line: 6 }, + end: { column: 15, line: 6 }, + }, + }, + + range: [147, 160], + loc: { + start: { column: 2, line: 6 }, + end: { column: 15, line: 6 }, + }, + }, + + range: [147, 161], + loc: { + start: { column: 2, line: 6 }, + end: { column: 16, line: 6 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [164, 167], + loc: { + start: { column: 2, line: 7 }, + end: { column: 5, line: 7 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [168, 171], + loc: { + start: { column: 6, line: 7 }, + end: { column: 9, line: 7 }, + }, + }, + + range: [164, 171], + loc: { + start: { column: 2, line: 7 }, + end: { column: 9, line: 7 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [173, 178], + loc: { + start: { column: 11, line: 7 }, + end: { column: 16, line: 7 }, + }, + }, + + range: [164, 178], + loc: { + start: { column: 2, line: 7 }, + end: { column: 16, line: 7 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fn', +- optional: false, + + range: [179, 181], + loc: { + start: { column: 17, line: 7 }, + end: { column: 19, line: 7 }, + }, + }, + + range: [164, 181], + loc: { + start: { column: 2, line: 7 }, + end: { column: 19, line: 7 }, + }, + }, + optional: false, + + range: [164, 183], + loc: { + start: { column: 2, line: 7 }, + end: { column: 21, line: 7 }, + }, + }, + + range: [164, 183], + loc: { + start: { column: 2, line: 7 }, + end: { column: 21, line: 7 }, + }, + }, + + range: [164, 184], + loc: { + start: { column: 2, line: 7 }, + end: { column: 22, line: 7 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [187, 190], + loc: { + start: { column: 2, line: 8 }, + end: { column: 5, line: 8 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [191, 194], + loc: { + start: { column: 6, line: 8 }, + end: { column: 9, line: 8 }, + }, + }, + + range: [187, 194], + loc: { + start: { column: 2, line: 8 }, + end: { column: 9, line: 8 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [196, 201], + loc: { + start: { column: 11, line: 8 }, + end: { column: 16, line: 8 }, + }, + }, + + range: [187, 201], + loc: { + start: { column: 2, line: 8 }, + end: { column: 16, line: 8 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'fn', +- optional: false, + + range: [203, 205], + loc: { + start: { column: 18, line: 8 }, + end: { column: 20, line: 8 }, + }, + }, + + range: [187, 205], + loc: { + start: { column: 2, line: 8 }, + end: { column: 20, line: 8 }, + }, + }, + optional: false, + + range: [187, 207], + loc: { + start: { column: 2, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [187, 207], + loc: { + start: { column: 2, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [187, 208], + loc: { + start: { column: 2, line: 8 }, + end: { column: 23, line: 8 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [212, 215], + loc: { + start: { column: 2, line: 10 }, + end: { column: 5, line: 10 }, + }, + }, + optional: true, + + range: [212, 219], + loc: { + start: { column: 2, line: 10 }, + end: { column: 9, line: 10 }, + }, + }, + + range: [212, 219], + loc: { + start: { column: 2, line: 10 }, + end: { column: 9, line: 10 }, + }, + }, + + range: [212, 220], + loc: { + start: { column: 2, line: 10 }, + end: { column: 10, line: 10 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [223, 226], + loc: { + start: { column: 2, line: 11 }, + end: { column: 5, line: 11 }, + }, + }, + optional: true, + + range: [223, 230], + loc: { + start: { column: 2, line: 11 }, + end: { column: 9, line: 11 }, + }, + }, + optional: false, + + range: [223, 232], + loc: { + start: { column: 2, line: 11 }, + end: { column: 11, line: 11 }, + }, + }, + + range: [223, 232], + loc: { + start: { column: 2, line: 11 }, + end: { column: 11, line: 11 }, + }, + }, + + range: [223, 233], + loc: { + start: { column: 2, line: 11 }, + end: { column: 12, line: 11 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [236, 239], + loc: { + start: { column: 2, line: 12 }, + end: { column: 5, line: 12 }, + }, + }, + optional: true, + + range: [236, 243], + loc: { + start: { column: 2, line: 12 }, + end: { column: 9, line: 12 }, + }, + }, + optional: true, + + range: [236, 247], + loc: { + start: { column: 2, line: 12 }, + end: { column: 13, line: 12 }, + }, + }, + + range: [236, 247], + loc: { + start: { column: 2, line: 12 }, + end: { column: 13, line: 12 }, + }, + }, + + range: [236, 248], + loc: { + start: { column: 2, line: 12 }, + end: { column: 14, line: 12 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: CallExpression { + type: 'CallExpression', + arguments: Array [], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [252, 255], + loc: { + start: { column: 2, line: 14 }, + end: { column: 5, line: 14 }, + }, + }, + optional: true, + + range: [252, 259], + loc: { + start: { column: 2, line: 14 }, + end: { column: 9, line: 14 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [260, 263], + loc: { + start: { column: 10, line: 14 }, + end: { column: 13, line: 14 }, + }, + }, + + range: [252, 263], + loc: { + start: { column: 2, line: 14 }, + end: { column: 13, line: 14 }, + }, + }, + + range: [252, 263], + loc: { + start: { column: 2, line: 14 }, + end: { column: 13, line: 14 }, + }, + }, + + range: [252, 264], + loc: { + start: { column: 2, line: 14 }, + end: { column: 14, line: 14 }, + }, + }, + ], + + range: [113, 266], + loc: { + start: { column: 40, line: 3 }, + end: { column: 1, line: 15 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processOptionalCall', +- optional: false, + + range: [82, 101], + loc: { + start: { column: 9, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [108, 111], + loc: { + start: { column: 35, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [106, 111], + loc: { + start: { column: 33, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [102, 111], + loc: { + start: { column: 29, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + ], + + range: [73, 266], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 15 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 267], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 16 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-non-null-assertion/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-non-null-assertion/snapshots/1-TSESTree-AST.shot index 0bf80db9665..439163a1809 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-non-null-assertion/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-non-null-assertion/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [113, 116], loc: { @@ -61,7 +63,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [127, 132], loc: { @@ -104,7 +108,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [137, 140], loc: { @@ -148,7 +154,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [152, 157], loc: { @@ -184,7 +192,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [162, 165], loc: { @@ -228,7 +238,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [177, 182], loc: { @@ -264,7 +276,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [186, 189], loc: { @@ -275,7 +289,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [191, 194], loc: { @@ -344,7 +360,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [209, 212], loc: { @@ -355,7 +373,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [214, 217], loc: { @@ -424,7 +444,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [233, 236], loc: { @@ -435,7 +457,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [238, 241], loc: { @@ -498,11 +522,14 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "processOptional", + optional: false, range: [82, 97], loc: { @@ -513,6 +540,7 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "one", optional: true, typeAnnotation: TSTypeAnnotation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot index dd256689be6..f1e51dec98a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,591 @@ exports[`AST Fixtures legacy-fixtures basics optional-chain-element-access-with-non-null-assertion AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [113, 116], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '\\\\'two\\\\'', + value: 'two', + + range: [119, 124], + loc: { + start: { column: 8, line: 4 }, + end: { column: 13, line: 4 }, + }, + }, + + range: [113, 125], + loc: { + start: { column: 2, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + + range: [113, 126], + loc: { + start: { column: 2, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [127, 132], + loc: { + start: { column: 16, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + + range: [113, 132], + loc: { + start: { column: 2, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + + range: [113, 132], + loc: { + start: { column: 2, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + + range: [113, 133], + loc: { + start: { column: 2, line: 4 }, + end: { column: 22, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [137, 140], + loc: { + start: { column: 3, line: 5 }, + end: { column: 6, line: 5 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '\\\\'two\\\\'', + value: 'two', + + range: [143, 148], + loc: { + start: { column: 9, line: 5 }, + end: { column: 14, line: 5 }, + }, + }, + + range: [137, 149], + loc: { + start: { column: 3, line: 5 }, + end: { column: 15, line: 5 }, + }, + }, + + range: [137, 149], + loc: { + start: { column: 3, line: 5 }, + end: { column: 15, line: 5 }, + }, + }, + + range: [136, 151], + loc: { + start: { column: 2, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [152, 157], + loc: { + start: { column: 18, line: 5 }, + end: { column: 23, line: 5 }, + }, + }, + + range: [136, 157], + loc: { + start: { column: 2, line: 5 }, + end: { column: 23, line: 5 }, + }, + }, + + range: [136, 158], + loc: { + start: { column: 2, line: 5 }, + end: { column: 24, line: 5 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [162, 165], + loc: { + start: { column: 3, line: 6 }, + end: { column: 6, line: 6 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '\\\\'two\\\\'', + value: 'two', + + range: [168, 173], + loc: { + start: { column: 9, line: 6 }, + end: { column: 14, line: 6 }, + }, + }, + + range: [162, 174], + loc: { + start: { column: 3, line: 6 }, + end: { column: 15, line: 6 }, + }, + }, + + range: [162, 174], + loc: { + start: { column: 3, line: 6 }, + end: { column: 15, line: 6 }, + }, + }, + + range: [161, 176], + loc: { + start: { column: 2, line: 6 }, + end: { column: 17, line: 6 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [177, 182], + loc: { + start: { column: 18, line: 6 }, + end: { column: 23, line: 6 }, + }, + }, + + range: [161, 182], + loc: { + start: { column: 2, line: 6 }, + end: { column: 23, line: 6 }, + }, + }, + + range: [161, 183], + loc: { + start: { column: 2, line: 6 }, + end: { column: 24, line: 6 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [186, 189], + loc: { + start: { column: 2, line: 7 }, + end: { column: 5, line: 7 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [191, 194], + loc: { + start: { column: 7, line: 7 }, + end: { column: 10, line: 7 }, + }, + }, + + range: [186, 194], + loc: { + start: { column: 2, line: 7 }, + end: { column: 10, line: 7 }, + }, + }, + + range: [186, 195], + loc: { + start: { column: 2, line: 7 }, + end: { column: 11, line: 7 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '\\\\'three\\\\'', + value: 'three', + + range: [196, 203], + loc: { + start: { column: 12, line: 7 }, + end: { column: 19, line: 7 }, + }, + }, + + range: [186, 204], + loc: { + start: { column: 2, line: 7 }, + end: { column: 20, line: 7 }, + }, + }, + + range: [186, 204], + loc: { + start: { column: 2, line: 7 }, + end: { column: 20, line: 7 }, + }, + }, + + range: [186, 205], + loc: { + start: { column: 2, line: 7 }, + end: { column: 21, line: 7 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [209, 212], + loc: { + start: { column: 3, line: 8 }, + end: { column: 6, line: 8 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [214, 217], + loc: { + start: { column: 8, line: 8 }, + end: { column: 11, line: 8 }, + }, + }, + + range: [209, 217], + loc: { + start: { column: 3, line: 8 }, + end: { column: 11, line: 8 }, + }, + }, + + range: [209, 217], + loc: { + start: { column: 3, line: 8 }, + end: { column: 11, line: 8 }, + }, + }, + + range: [208, 219], + loc: { + start: { column: 2, line: 8 }, + end: { column: 13, line: 8 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '\\\\'three\\\\'', + value: 'three', + + range: [220, 227], + loc: { + start: { column: 14, line: 8 }, + end: { column: 21, line: 8 }, + }, + }, + + range: [208, 228], + loc: { + start: { column: 2, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [208, 229], + loc: { + start: { column: 2, line: 8 }, + end: { column: 23, line: 8 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [233, 236], + loc: { + start: { column: 3, line: 9 }, + end: { column: 6, line: 9 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [238, 241], + loc: { + start: { column: 8, line: 9 }, + end: { column: 11, line: 9 }, + }, + }, + + range: [233, 241], + loc: { + start: { column: 3, line: 9 }, + end: { column: 11, line: 9 }, + }, + }, + + range: [233, 241], + loc: { + start: { column: 3, line: 9 }, + end: { column: 11, line: 9 }, + }, + }, + + range: [232, 243], + loc: { + start: { column: 2, line: 9 }, + end: { column: 13, line: 9 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '\\\\'three\\\\'', + value: 'three', + + range: [244, 251], + loc: { + start: { column: 14, line: 9 }, + end: { column: 21, line: 9 }, + }, + }, + + range: [232, 252], + loc: { + start: { column: 2, line: 9 }, + end: { column: 22, line: 9 }, + }, + }, + + range: [232, 253], + loc: { + start: { column: 2, line: 9 }, + end: { column: 23, line: 9 }, + }, + }, + ], + + range: [109, 255], + loc: { + start: { column: 36, line: 3 }, + end: { column: 1, line: 10 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processOptional', +- optional: false, + + range: [82, 97], + loc: { + start: { column: 9, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [104, 107], + loc: { + start: { column: 31, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [102, 107], + loc: { + start: { column: 29, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [98, 107], + loc: { + start: { column: 25, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + ], + + range: [73, 255], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 10 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 256], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 11 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-parens/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-parens/snapshots/1-TSESTree-AST.shot index 4f4d118456f..a90929d31bc 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-parens/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-parens/snapshots/1-TSESTree-AST.shot @@ -19,7 +19,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [126, 129], loc: { @@ -72,7 +74,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [139, 142], loc: { @@ -144,7 +148,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [155, 158], loc: { @@ -219,7 +225,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [171, 174], loc: { @@ -313,7 +321,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [190, 193], loc: { @@ -410,7 +420,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [211, 214], loc: { @@ -516,11 +528,14 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "processOptionalElementParens", + optional: false, range: [82, 110], loc: { @@ -531,6 +546,7 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "one", optional: true, typeAnnotation: TSTypeAnnotation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-parens/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-parens/snapshots/5-AST-Alignment-AST.shot index 1e8a8d85074..55220826fb1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-parens/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access-with-parens/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,597 @@ exports[`AST Fixtures legacy-fixtures basics optional-chain-element-access-with-parens AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [126, 129], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [132, 133], + loc: { + start: { column: 8, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + + range: [126, 134], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [126, 134], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [126, 135], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [139, 142], + loc: { + start: { column: 3, line: 5 }, + end: { column: 6, line: 5 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [145, 146], + loc: { + start: { column: 9, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + + range: [139, 147], + loc: { + start: { column: 3, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + + range: [139, 147], + loc: { + start: { column: 3, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [149, 150], + loc: { + start: { column: 13, line: 5 }, + end: { column: 14, line: 5 }, + }, + }, + + range: [138, 151], + loc: { + start: { column: 2, line: 5 }, + end: { column: 15, line: 5 }, + }, + }, + + range: [138, 152], + loc: { + start: { column: 2, line: 5 }, + end: { column: 16, line: 5 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [155, 158], + loc: { + start: { column: 2, line: 6 }, + end: { column: 5, line: 6 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [159, 160], + loc: { + start: { column: 6, line: 6 }, + end: { column: 7, line: 6 }, + }, + }, + + range: [155, 161], + loc: { + start: { column: 2, line: 6 }, + end: { column: 8, line: 6 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [164, 165], + loc: { + start: { column: 11, line: 6 }, + end: { column: 12, line: 6 }, + }, + }, + + range: [155, 166], + loc: { + start: { column: 2, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + + range: [155, 166], + loc: { + start: { column: 2, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + + range: [155, 167], + loc: { + start: { column: 2, line: 6 }, + end: { column: 14, line: 6 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [171, 174], + loc: { + start: { column: 3, line: 7 }, + end: { column: 6, line: 7 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [175, 176], + loc: { + start: { column: 7, line: 7 }, + end: { column: 8, line: 7 }, + }, + }, + + range: [171, 177], + loc: { + start: { column: 3, line: 7 }, + end: { column: 9, line: 7 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [180, 181], + loc: { + start: { column: 12, line: 7 }, + end: { column: 13, line: 7 }, + }, + }, + + range: [171, 182], + loc: { + start: { column: 3, line: 7 }, + end: { column: 14, line: 7 }, + }, + }, + + range: [171, 182], + loc: { + start: { column: 3, line: 7 }, + end: { column: 14, line: 7 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '4', + value: 4, + + range: [184, 185], + loc: { + start: { column: 16, line: 7 }, + end: { column: 17, line: 7 }, + }, + }, + + range: [170, 186], + loc: { + start: { column: 2, line: 7 }, + end: { column: 18, line: 7 }, + }, + }, + + range: [170, 187], + loc: { + start: { column: 2, line: 7 }, + end: { column: 19, line: 7 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [190, 193], + loc: { + start: { column: 2, line: 8 }, + end: { column: 5, line: 8 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [194, 195], + loc: { + start: { column: 6, line: 8 }, + end: { column: 7, line: 8 }, + }, + }, + + range: [190, 196], + loc: { + start: { column: 2, line: 8 }, + end: { column: 8, line: 8 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [199, 200], + loc: { + start: { column: 11, line: 8 }, + end: { column: 12, line: 8 }, + }, + }, + + range: [190, 201], + loc: { + start: { column: 2, line: 8 }, + end: { column: 13, line: 8 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '4', + value: 4, + + range: [204, 205], + loc: { + start: { column: 16, line: 8 }, + end: { column: 17, line: 8 }, + }, + }, + + range: [190, 206], + loc: { + start: { column: 2, line: 8 }, + end: { column: 18, line: 8 }, + }, + }, + + range: [190, 206], + loc: { + start: { column: 2, line: 8 }, + end: { column: 18, line: 8 }, + }, + }, + + range: [190, 207], + loc: { + start: { column: 2, line: 8 }, + end: { column: 19, line: 8 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [211, 214], + loc: { + start: { column: 3, line: 9 }, + end: { column: 6, line: 9 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [215, 216], + loc: { + start: { column: 7, line: 9 }, + end: { column: 8, line: 9 }, + }, + }, + + range: [211, 217], + loc: { + start: { column: 3, line: 9 }, + end: { column: 9, line: 9 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [220, 221], + loc: { + start: { column: 12, line: 9 }, + end: { column: 13, line: 9 }, + }, + }, + + range: [211, 222], + loc: { + start: { column: 3, line: 9 }, + end: { column: 14, line: 9 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '4', + value: 4, + + range: [225, 226], + loc: { + start: { column: 17, line: 9 }, + end: { column: 18, line: 9 }, + }, + }, + + range: [211, 227], + loc: { + start: { column: 3, line: 9 }, + end: { column: 19, line: 9 }, + }, + }, + + range: [211, 227], + loc: { + start: { column: 3, line: 9 }, + end: { column: 19, line: 9 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '5', + value: 5, + + range: [229, 230], + loc: { + start: { column: 21, line: 9 }, + end: { column: 22, line: 9 }, + }, + }, + + range: [210, 231], + loc: { + start: { column: 2, line: 9 }, + end: { column: 23, line: 9 }, + }, + }, + + range: [210, 232], + loc: { + start: { column: 2, line: 9 }, + end: { column: 24, line: 9 }, + }, + }, + ], + + range: [122, 234], + loc: { + start: { column: 49, line: 3 }, + end: { column: 1, line: 10 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processOptionalElementParens', +- optional: false, + + range: [82, 110], + loc: { + start: { column: 9, line: 3 }, + end: { column: 37, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [117, 120], + loc: { + start: { column: 44, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + + range: [115, 120], + loc: { + start: { column: 42, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + + range: [111, 120], + loc: { + start: { column: 38, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + ], + + range: [73, 234], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 10 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 235], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 11 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access/snapshots/1-TSESTree-AST.shot index aac8b331347..a4764cc076c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access/snapshots/1-TSESTree-AST.shot @@ -19,7 +19,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [120, 123], loc: { @@ -72,7 +74,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [132, 135], loc: { @@ -144,7 +148,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [147, 150], loc: { @@ -216,7 +222,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [162, 165], loc: { @@ -291,7 +299,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [177, 180], loc: { @@ -385,7 +395,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [195, 198], loc: { @@ -472,11 +484,14 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "processOptionalElement", + optional: false, range: [82, 104], loc: { @@ -487,6 +502,7 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "one", optional: true, typeAnnotation: TSTypeAnnotation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access/snapshots/5-AST-Alignment-AST.shot index dc5647c5cbe..41e81dfd102 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-element-access/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,553 @@ exports[`AST Fixtures legacy-fixtures basics optional-chain-element-access AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [120, 123], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [126, 127], + loc: { + start: { column: 8, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + + range: [120, 128], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [120, 128], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [120, 129], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [132, 135], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [138, 139], + loc: { + start: { column: 8, line: 5 }, + end: { column: 9, line: 5 }, + }, + }, + + range: [132, 140], + loc: { + start: { column: 2, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [141, 142], + loc: { + start: { column: 11, line: 5 }, + end: { column: 12, line: 5 }, + }, + }, + + range: [132, 143], + loc: { + start: { column: 2, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, + + range: [132, 143], + loc: { + start: { column: 2, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, + + range: [132, 144], + loc: { + start: { column: 2, line: 5 }, + end: { column: 14, line: 5 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [147, 150], + loc: { + start: { column: 2, line: 6 }, + end: { column: 5, line: 6 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [151, 152], + loc: { + start: { column: 6, line: 6 }, + end: { column: 7, line: 6 }, + }, + }, + + range: [147, 153], + loc: { + start: { column: 2, line: 6 }, + end: { column: 8, line: 6 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [156, 157], + loc: { + start: { column: 11, line: 6 }, + end: { column: 12, line: 6 }, + }, + }, + + range: [147, 158], + loc: { + start: { column: 2, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + + range: [147, 158], + loc: { + start: { column: 2, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + + range: [147, 159], + loc: { + start: { column: 2, line: 6 }, + end: { column: 14, line: 6 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [162, 165], + loc: { + start: { column: 2, line: 7 }, + end: { column: 5, line: 7 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [166, 167], + loc: { + start: { column: 6, line: 7 }, + end: { column: 7, line: 7 }, + }, + }, + + range: [162, 168], + loc: { + start: { column: 2, line: 7 }, + end: { column: 8, line: 7 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [171, 172], + loc: { + start: { column: 11, line: 7 }, + end: { column: 12, line: 7 }, + }, + }, + + range: [162, 173], + loc: { + start: { column: 2, line: 7 }, + end: { column: 13, line: 7 }, + }, + }, + + range: [162, 173], + loc: { + start: { column: 2, line: 7 }, + end: { column: 13, line: 7 }, + }, + }, + + range: [162, 174], + loc: { + start: { column: 2, line: 7 }, + end: { column: 14, line: 7 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [177, 180], + loc: { + start: { column: 2, line: 8 }, + end: { column: 5, line: 8 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [181, 182], + loc: { + start: { column: 6, line: 8 }, + end: { column: 7, line: 8 }, + }, + }, + + range: [177, 183], + loc: { + start: { column: 2, line: 8 }, + end: { column: 8, line: 8 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [186, 187], + loc: { + start: { column: 11, line: 8 }, + end: { column: 12, line: 8 }, + }, + }, + + range: [177, 188], + loc: { + start: { column: 2, line: 8 }, + end: { column: 13, line: 8 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '4', + value: 4, + + range: [189, 190], + loc: { + start: { column: 14, line: 8 }, + end: { column: 15, line: 8 }, + }, + }, + + range: [177, 191], + loc: { + start: { column: 2, line: 8 }, + end: { column: 16, line: 8 }, + }, + }, + + range: [177, 191], + loc: { + start: { column: 2, line: 8 }, + end: { column: 16, line: 8 }, + }, + }, + + range: [177, 192], + loc: { + start: { column: 2, line: 8 }, + end: { column: 17, line: 8 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [195, 198], + loc: { + start: { column: 2, line: 9 }, + end: { column: 5, line: 9 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '2', + value: 2, + + range: [199, 200], + loc: { + start: { column: 6, line: 9 }, + end: { column: 7, line: 9 }, + }, + }, + + range: [195, 201], + loc: { + start: { column: 2, line: 9 }, + end: { column: 8, line: 9 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '3', + value: 3, + + range: [204, 205], + loc: { + start: { column: 11, line: 9 }, + end: { column: 12, line: 9 }, + }, + }, + + range: [195, 206], + loc: { + start: { column: 2, line: 9 }, + end: { column: 13, line: 9 }, + }, + }, + optional: true, + property: Literal { + type: 'Literal', + raw: '4', + value: 4, + + range: [209, 210], + loc: { + start: { column: 16, line: 9 }, + end: { column: 17, line: 9 }, + }, + }, + + range: [195, 211], + loc: { + start: { column: 2, line: 9 }, + end: { column: 18, line: 9 }, + }, + }, + + range: [195, 211], + loc: { + start: { column: 2, line: 9 }, + end: { column: 18, line: 9 }, + }, + }, + + range: [195, 212], + loc: { + start: { column: 2, line: 9 }, + end: { column: 19, line: 9 }, + }, + }, + ], + + range: [116, 214], + loc: { + start: { column: 43, line: 3 }, + end: { column: 1, line: 10 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processOptionalElement', +- optional: false, + + range: [82, 104], + loc: { + start: { column: 9, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [111, 114], + loc: { + start: { column: 38, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + + range: [109, 114], + loc: { + start: { column: 36, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + + range: [105, 114], + loc: { + start: { column: 32, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + ], + + range: [73, 214], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 10 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 215], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 11 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-non-null-assertion/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-non-null-assertion/snapshots/1-TSESTree-AST.shot index a06cd536542..9bc688630e7 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-non-null-assertion/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-non-null-assertion/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [113, 116], loc: { @@ -35,7 +37,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [118, 121], loc: { @@ -60,7 +64,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [123, 128], loc: { @@ -103,7 +109,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [133, 136], loc: { @@ -114,7 +122,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [138, 141], loc: { @@ -146,7 +156,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [144, 149], loc: { @@ -182,7 +194,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [154, 157], loc: { @@ -193,7 +207,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [159, 162], loc: { @@ -225,7 +241,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [165, 170], loc: { @@ -255,11 +273,14 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "processOptional", + optional: false, range: [82, 97], loc: { @@ -270,6 +291,7 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "one", optional: true, typeAnnotation: TSTypeAnnotation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot index 633b2b7bf60..f8f7fba79fd 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-non-null-assertion/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,342 @@ exports[`AST Fixtures legacy-fixtures basics optional-chain-with-non-null-assertion AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [113, 116], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [118, 121], + loc: { + start: { column: 7, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [113, 121], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [113, 122], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [123, 128], + loc: { + start: { column: 12, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + + range: [113, 128], + loc: { + start: { column: 2, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + + range: [113, 128], + loc: { + start: { column: 2, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + + range: [113, 129], + loc: { + start: { column: 2, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [133, 136], + loc: { + start: { column: 3, line: 5 }, + end: { column: 6, line: 5 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [138, 141], + loc: { + start: { column: 8, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + + range: [133, 141], + loc: { + start: { column: 3, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + + range: [133, 141], + loc: { + start: { column: 3, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + + range: [132, 143], + loc: { + start: { column: 2, line: 5 }, + end: { column: 13, line: 5 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [144, 149], + loc: { + start: { column: 14, line: 5 }, + end: { column: 19, line: 5 }, + }, + }, + + range: [132, 149], + loc: { + start: { column: 2, line: 5 }, + end: { column: 19, line: 5 }, + }, + }, + + range: [132, 150], + loc: { + start: { column: 2, line: 5 }, + end: { column: 20, line: 5 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: TSNonNullExpression { + type: 'TSNonNullExpression', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [154, 157], + loc: { + start: { column: 3, line: 6 }, + end: { column: 6, line: 6 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [159, 162], + loc: { + start: { column: 8, line: 6 }, + end: { column: 11, line: 6 }, + }, + }, + + range: [154, 162], + loc: { + start: { column: 3, line: 6 }, + end: { column: 11, line: 6 }, + }, + }, + + range: [154, 162], + loc: { + start: { column: 3, line: 6 }, + end: { column: 11, line: 6 }, + }, + }, + + range: [153, 164], + loc: { + start: { column: 2, line: 6 }, + end: { column: 13, line: 6 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [165, 170], + loc: { + start: { column: 14, line: 6 }, + end: { column: 19, line: 6 }, + }, + }, + + range: [153, 170], + loc: { + start: { column: 2, line: 6 }, + end: { column: 19, line: 6 }, + }, + }, + + range: [153, 171], + loc: { + start: { column: 2, line: 6 }, + end: { column: 20, line: 6 }, + }, + }, + ], + + range: [109, 173], + loc: { + start: { column: 36, line: 3 }, + end: { column: 1, line: 7 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processOptional', +- optional: false, + + range: [82, 97], + loc: { + start: { column: 9, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [104, 107], + loc: { + start: { column: 31, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [102, 107], + loc: { + start: { column: 29, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [98, 107], + loc: { + start: { column: 25, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + ], + + range: [73, 173], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 7 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 174], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 8 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-parens/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-parens/snapshots/1-TSESTree-AST.shot index bb096f73fc4..e6778ccedc2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-parens/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-parens/snapshots/1-TSESTree-AST.shot @@ -19,7 +19,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [119, 122], loc: { @@ -30,7 +32,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [124, 127], loc: { @@ -71,7 +75,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [132, 135], loc: { @@ -82,7 +88,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [137, 140], loc: { @@ -107,7 +115,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [142, 147], loc: { @@ -141,7 +151,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [151, 154], loc: { @@ -152,7 +164,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [155, 158], loc: { @@ -170,7 +184,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [160, 165], loc: { @@ -214,7 +230,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [170, 173], loc: { @@ -225,7 +243,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [174, 177], loc: { @@ -243,7 +263,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [179, 184], loc: { @@ -268,7 +290,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "four", + optional: false, range: [186, 190], loc: { @@ -305,7 +329,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [194, 197], loc: { @@ -316,7 +342,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [198, 201], loc: { @@ -334,7 +362,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [203, 208], loc: { @@ -352,7 +382,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "four", + optional: false, range: [210, 214], loc: { @@ -399,7 +431,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [219, 222], loc: { @@ -410,7 +444,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [223, 226], loc: { @@ -428,7 +464,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [228, 233], loc: { @@ -446,7 +484,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "four", + optional: false, range: [235, 239], loc: { @@ -471,7 +511,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "five", + optional: false, range: [241, 245], loc: { @@ -501,11 +543,14 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "processOptionalParens", + optional: false, range: [82, 103], loc: { @@ -516,6 +561,7 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "one", optional: true, typeAnnotation: TSTypeAnnotation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-parens/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-parens/snapshots/5-AST-Alignment-AST.shot index 1b2f2b79375..9641828c0eb 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-parens/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain-with-parens/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,612 @@ exports[`AST Fixtures legacy-fixtures basics optional-chain-with-parens AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [119, 122], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [124, 127], + loc: { + start: { column: 7, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [119, 127], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [119, 127], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [119, 128], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [132, 135], + loc: { + start: { column: 3, line: 5 }, + end: { column: 6, line: 5 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [137, 140], + loc: { + start: { column: 8, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + + range: [132, 140], + loc: { + start: { column: 3, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + + range: [132, 140], + loc: { + start: { column: 3, line: 5 }, + end: { column: 11, line: 5 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [142, 147], + loc: { + start: { column: 13, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + + range: [131, 147], + loc: { + start: { column: 2, line: 5 }, + end: { column: 18, line: 5 }, + }, + }, + + range: [131, 148], + loc: { + start: { column: 2, line: 5 }, + end: { column: 19, line: 5 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [151, 154], + loc: { + start: { column: 2, line: 6 }, + end: { column: 5, line: 6 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [155, 158], + loc: { + start: { column: 6, line: 6 }, + end: { column: 9, line: 6 }, + }, + }, + + range: [151, 158], + loc: { + start: { column: 2, line: 6 }, + end: { column: 9, line: 6 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [160, 165], + loc: { + start: { column: 11, line: 6 }, + end: { column: 16, line: 6 }, + }, + }, + + range: [151, 165], + loc: { + start: { column: 2, line: 6 }, + end: { column: 16, line: 6 }, + }, + }, + + range: [151, 165], + loc: { + start: { column: 2, line: 6 }, + end: { column: 16, line: 6 }, + }, + }, + + range: [151, 166], + loc: { + start: { column: 2, line: 6 }, + end: { column: 17, line: 6 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [170, 173], + loc: { + start: { column: 3, line: 7 }, + end: { column: 6, line: 7 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [174, 177], + loc: { + start: { column: 7, line: 7 }, + end: { column: 10, line: 7 }, + }, + }, + + range: [170, 177], + loc: { + start: { column: 3, line: 7 }, + end: { column: 10, line: 7 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [179, 184], + loc: { + start: { column: 12, line: 7 }, + end: { column: 17, line: 7 }, + }, + }, + + range: [170, 184], + loc: { + start: { column: 3, line: 7 }, + end: { column: 17, line: 7 }, + }, + }, + + range: [170, 184], + loc: { + start: { column: 3, line: 7 }, + end: { column: 17, line: 7 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'four', +- optional: false, + + range: [186, 190], + loc: { + start: { column: 19, line: 7 }, + end: { column: 23, line: 7 }, + }, + }, + + range: [169, 190], + loc: { + start: { column: 2, line: 7 }, + end: { column: 23, line: 7 }, + }, + }, + + range: [169, 191], + loc: { + start: { column: 2, line: 7 }, + end: { column: 24, line: 7 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [194, 197], + loc: { + start: { column: 2, line: 8 }, + end: { column: 5, line: 8 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [198, 201], + loc: { + start: { column: 6, line: 8 }, + end: { column: 9, line: 8 }, + }, + }, + + range: [194, 201], + loc: { + start: { column: 2, line: 8 }, + end: { column: 9, line: 8 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [203, 208], + loc: { + start: { column: 11, line: 8 }, + end: { column: 16, line: 8 }, + }, + }, + + range: [194, 208], + loc: { + start: { column: 2, line: 8 }, + end: { column: 16, line: 8 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'four', +- optional: false, + + range: [210, 214], + loc: { + start: { column: 18, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [194, 214], + loc: { + start: { column: 2, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [194, 214], + loc: { + start: { column: 2, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [194, 215], + loc: { + start: { column: 2, line: 8 }, + end: { column: 23, line: 8 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [219, 222], + loc: { + start: { column: 3, line: 9 }, + end: { column: 6, line: 9 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [223, 226], + loc: { + start: { column: 7, line: 9 }, + end: { column: 10, line: 9 }, + }, + }, + + range: [219, 226], + loc: { + start: { column: 3, line: 9 }, + end: { column: 10, line: 9 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [228, 233], + loc: { + start: { column: 12, line: 9 }, + end: { column: 17, line: 9 }, + }, + }, + + range: [219, 233], + loc: { + start: { column: 3, line: 9 }, + end: { column: 17, line: 9 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'four', +- optional: false, + + range: [235, 239], + loc: { + start: { column: 19, line: 9 }, + end: { column: 23, line: 9 }, + }, + }, + + range: [219, 239], + loc: { + start: { column: 3, line: 9 }, + end: { column: 23, line: 9 }, + }, + }, + + range: [219, 239], + loc: { + start: { column: 3, line: 9 }, + end: { column: 23, line: 9 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'five', +- optional: false, + + range: [241, 245], + loc: { + start: { column: 25, line: 9 }, + end: { column: 29, line: 9 }, + }, + }, + + range: [218, 245], + loc: { + start: { column: 2, line: 9 }, + end: { column: 29, line: 9 }, + }, + }, + + range: [218, 246], + loc: { + start: { column: 2, line: 9 }, + end: { column: 30, line: 9 }, + }, + }, + ], + + range: [115, 248], + loc: { + start: { column: 42, line: 3 }, + end: { column: 1, line: 10 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processOptionalParens', +- optional: false, + + range: [82, 103], + loc: { + start: { column: 9, line: 3 }, + end: { column: 30, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [110, 113], + loc: { + start: { column: 37, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + + range: [108, 113], + loc: { + start: { column: 35, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + + range: [104, 113], + loc: { + start: { column: 31, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + ], + + range: [73, 248], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 10 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 249], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 11 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain/snapshots/1-TSESTree-AST.shot index 613e9dc1559..87574ada8d8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain/snapshots/1-TSESTree-AST.shot @@ -19,7 +19,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [113, 116], loc: { @@ -30,7 +32,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [118, 121], loc: { @@ -71,7 +75,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [125, 128], loc: { @@ -82,7 +88,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [130, 133], loc: { @@ -100,7 +108,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [134, 139], loc: { @@ -141,7 +151,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [143, 146], loc: { @@ -152,7 +164,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [147, 150], loc: { @@ -170,7 +184,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [152, 157], loc: { @@ -214,7 +230,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [161, 164], loc: { @@ -225,7 +243,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [165, 168], loc: { @@ -243,7 +263,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [170, 175], loc: { @@ -261,7 +283,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "four", + optional: false, range: [176, 180], loc: { @@ -305,7 +329,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "one", + optional: false, range: [184, 187], loc: { @@ -316,7 +342,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "two", + optional: false, range: [188, 191], loc: { @@ -334,7 +362,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "three", + optional: false, range: [193, 198], loc: { @@ -352,7 +382,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "four", + optional: false, range: [200, 204], loc: { @@ -389,11 +421,14 @@ Program { end: { column: 1, line: 9 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "processOptional", + optional: false, range: [82, 97], loc: { @@ -404,6 +439,7 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "one", optional: true, typeAnnotation: TSTypeAnnotation { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain/snapshots/5-AST-Alignment-AST.shot index 92619481bec..591495e977f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/optional-chain/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,490 @@ exports[`AST Fixtures legacy-fixtures basics optional-chain AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [113, 116], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [118, 121], + loc: { + start: { column: 7, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [113, 121], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [113, 121], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + + range: [113, 122], + loc: { + start: { column: 2, line: 4 }, + end: { column: 11, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [125, 128], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [130, 133], + loc: { + start: { column: 7, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + + range: [125, 133], + loc: { + start: { column: 2, line: 5 }, + end: { column: 10, line: 5 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [134, 139], + loc: { + start: { column: 11, line: 5 }, + end: { column: 16, line: 5 }, + }, + }, + + range: [125, 139], + loc: { + start: { column: 2, line: 5 }, + end: { column: 16, line: 5 }, + }, + }, + + range: [125, 139], + loc: { + start: { column: 2, line: 5 }, + end: { column: 16, line: 5 }, + }, + }, + + range: [125, 140], + loc: { + start: { column: 2, line: 5 }, + end: { column: 17, line: 5 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [143, 146], + loc: { + start: { column: 2, line: 6 }, + end: { column: 5, line: 6 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [147, 150], + loc: { + start: { column: 6, line: 6 }, + end: { column: 9, line: 6 }, + }, + }, + + range: [143, 150], + loc: { + start: { column: 2, line: 6 }, + end: { column: 9, line: 6 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [152, 157], + loc: { + start: { column: 11, line: 6 }, + end: { column: 16, line: 6 }, + }, + }, + + range: [143, 157], + loc: { + start: { column: 2, line: 6 }, + end: { column: 16, line: 6 }, + }, + }, + + range: [143, 157], + loc: { + start: { column: 2, line: 6 }, + end: { column: 16, line: 6 }, + }, + }, + + range: [143, 158], + loc: { + start: { column: 2, line: 6 }, + end: { column: 17, line: 6 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [161, 164], + loc: { + start: { column: 2, line: 7 }, + end: { column: 5, line: 7 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [165, 168], + loc: { + start: { column: 6, line: 7 }, + end: { column: 9, line: 7 }, + }, + }, + + range: [161, 168], + loc: { + start: { column: 2, line: 7 }, + end: { column: 9, line: 7 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [170, 175], + loc: { + start: { column: 11, line: 7 }, + end: { column: 16, line: 7 }, + }, + }, + + range: [161, 175], + loc: { + start: { column: 2, line: 7 }, + end: { column: 16, line: 7 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'four', +- optional: false, + + range: [176, 180], + loc: { + start: { column: 17, line: 7 }, + end: { column: 21, line: 7 }, + }, + }, + + range: [161, 180], + loc: { + start: { column: 2, line: 7 }, + end: { column: 21, line: 7 }, + }, + }, + + range: [161, 180], + loc: { + start: { column: 2, line: 7 }, + end: { column: 21, line: 7 }, + }, + }, + + range: [161, 181], + loc: { + start: { column: 2, line: 7 }, + end: { column: 22, line: 7 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: ChainExpression { + type: 'ChainExpression', + expression: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', +- optional: false, + + range: [184, 187], + loc: { + start: { column: 2, line: 8 }, + end: { column: 5, line: 8 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'two', +- optional: false, + + range: [188, 191], + loc: { + start: { column: 6, line: 8 }, + end: { column: 9, line: 8 }, + }, + }, + + range: [184, 191], + loc: { + start: { column: 2, line: 8 }, + end: { column: 9, line: 8 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'three', +- optional: false, + + range: [193, 198], + loc: { + start: { column: 11, line: 8 }, + end: { column: 16, line: 8 }, + }, + }, + + range: [184, 198], + loc: { + start: { column: 2, line: 8 }, + end: { column: 16, line: 8 }, + }, + }, + optional: true, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'four', +- optional: false, + + range: [200, 204], + loc: { + start: { column: 18, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [184, 204], + loc: { + start: { column: 2, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [184, 204], + loc: { + start: { column: 2, line: 8 }, + end: { column: 22, line: 8 }, + }, + }, + + range: [184, 205], + loc: { + start: { column: 2, line: 8 }, + end: { column: 23, line: 8 }, + }, + }, + ], + + range: [109, 207], + loc: { + start: { column: 36, line: 3 }, + end: { column: 1, line: 9 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'processOptional', +- optional: false, + + range: [82, 97], + loc: { + start: { column: 9, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'one', + optional: true, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [104, 107], + loc: { + start: { column: 31, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [102, 107], + loc: { + start: { column: 29, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [98, 107], + loc: { + start: { column: 25, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + ], + + range: [73, 207], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 9 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 208], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 10 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/private-fields-in-in/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/private-fields-in-in/snapshots/1-TSESTree-AST.shot index d7babfef7b3..c54b4a1d802 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/private-fields-in-in/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/private-fields-in-in/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,6 +14,8 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: PrivateIdentifier { type: "PrivateIdentifier", name: "prop1", @@ -23,7 +26,9 @@ Program { end: { column: 8, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: null, @@ -36,9 +41,12 @@ Program { MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "method", + optional: false, range: [97, 103], loc: { @@ -47,6 +55,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -72,7 +81,9 @@ Program { operator: "in", right: Identifier { type: "Identifier", + decorators: Array [], name: "arg", + optional: false, range: [132, 135], loc: { @@ -102,13 +113,16 @@ Program { end: { column: 3, line: 7 }, }, }, + declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "arg", + optional: false, range: [104, 107], loc: { @@ -139,9 +153,13 @@ Program { end: { column: 1, line: 8 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -149,6 +167,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 142], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/private-fields-in-in/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/private-fields-in-in/snapshots/5-AST-Alignment-AST.shot index 5d3082bbb16..95abc2ac122 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/private-fields-in-in/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/private-fields-in-in/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics private-fields-in-in AST Alignment body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,6 +18,8 @@ exports[`AST Fixtures legacy-fixtures basics private-fields-in-in AST Alignment type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: PrivateIdentifier { type: 'PrivateIdentifier', name: 'prop1', @@ -27,7 +30,9 @@ exports[`AST Fixtures legacy-fixtures basics private-fields-in-in AST Alignment end: { column: 8, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: null, @@ -40,9 +45,12 @@ exports[`AST Fixtures legacy-fixtures basics private-fields-in-in AST Alignment MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'method', +- optional: false, range: [97, 103], loc: { @@ -51,6 +59,7 @@ exports[`AST Fixtures legacy-fixtures basics private-fields-in-in AST Alignment }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -76,7 +85,9 @@ exports[`AST Fixtures legacy-fixtures basics private-fields-in-in AST Alignment operator: 'in', right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'arg', +- optional: false, range: [132, 135], loc: { @@ -106,13 +117,16 @@ exports[`AST Fixtures legacy-fixtures basics private-fields-in-in AST Alignment end: { column: 3, line: 7 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'arg', +- optional: false, range: [104, 107], loc: { @@ -143,9 +157,13 @@ exports[`AST Fixtures legacy-fixtures basics private-fields-in-in AST Alignment end: { column: 1, line: 8 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -153,6 +171,7 @@ exports[`AST Fixtures legacy-fixtures basics private-fields-in-in AST Alignment end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 142], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/1-TSESTree-AST.shot index d0e7554b413..e7c7e89c2a8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/1-TSESTree-AST.shot @@ -20,7 +20,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "arr", + optional: false, range: [118, 121], loc: { @@ -31,7 +33,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "slice", + optional: false, range: [122, 127], loc: { @@ -83,7 +87,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "arr", + optional: false, range: [141, 144], loc: { @@ -94,7 +100,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "push", + optional: false, range: [145, 149], loc: { @@ -132,11 +140,14 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [82, 85], loc: { @@ -147,7 +158,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "arr", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { @@ -174,7 +187,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "ReadonlyArray", + optional: false, range: [91, 104], loc: { @@ -247,7 +262,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "arr", + optional: false, range: [215, 218], loc: { @@ -258,7 +275,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "slice", + optional: false, range: [219, 224], loc: { @@ -310,7 +329,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "arr", + optional: false, range: [238, 241], loc: { @@ -321,7 +342,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "push", + optional: false, range: [242, 246], loc: { @@ -359,11 +382,14 @@ Program { end: { column: 1, line: 11 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [183, 186], loc: { @@ -374,7 +400,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "arr", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeOperator { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/5-AST-Alignment-AST.shot index 398454beb2d..9dc5b8fb7cc 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-arrays/snapshots/5-AST-Alignment-AST.shot @@ -24,7 +24,9 @@ exports[`AST Fixtures legacy-fixtures basics readonly-arrays AST Alignment - AST computed: false, object: Identifier { type: 'Identifier', +- decorators: Array [], name: 'arr', +- optional: false, range: [118, 121], loc: { @@ -35,7 +37,9 @@ exports[`AST Fixtures legacy-fixtures basics readonly-arrays AST Alignment - AST optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'slice', +- optional: false, range: [122, 127], loc: { @@ -87,7 +91,9 @@ exports[`AST Fixtures legacy-fixtures basics readonly-arrays AST Alignment - AST computed: false, object: Identifier { type: 'Identifier', +- decorators: Array [], name: 'arr', +- optional: false, range: [141, 144], loc: { @@ -98,7 +104,9 @@ exports[`AST Fixtures legacy-fixtures basics readonly-arrays AST Alignment - AST optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'push', +- optional: false, range: [145, 149], loc: { @@ -136,11 +144,14 @@ exports[`AST Fixtures legacy-fixtures basics readonly-arrays AST Alignment - AST end: { column: 1, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [82, 85], loc: { @@ -151,7 +162,9 @@ exports[`AST Fixtures legacy-fixtures basics readonly-arrays AST Alignment - AST params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'arr', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { @@ -178,7 +191,9 @@ exports[`AST Fixtures legacy-fixtures basics readonly-arrays AST Alignment - AST - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'ReadonlyArray', +- optional: false, range: [91, 104], loc: { @@ -251,7 +266,9 @@ exports[`AST Fixtures legacy-fixtures basics readonly-arrays AST Alignment - AST computed: false, object: Identifier { type: 'Identifier', +- decorators: Array [], name: 'arr', +- optional: false, range: [215, 218], loc: { @@ -262,7 +279,9 @@ exports[`AST Fixtures legacy-fixtures basics readonly-arrays AST Alignment - AST optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'slice', +- optional: false, range: [219, 224], loc: { @@ -314,7 +333,9 @@ exports[`AST Fixtures legacy-fixtures basics readonly-arrays AST Alignment - AST computed: false, object: Identifier { type: 'Identifier', +- decorators: Array [], name: 'arr', +- optional: false, range: [238, 241], loc: { @@ -325,7 +346,9 @@ exports[`AST Fixtures legacy-fixtures basics readonly-arrays AST Alignment - AST optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'push', +- optional: false, range: [242, 246], loc: { @@ -363,11 +386,14 @@ exports[`AST Fixtures legacy-fixtures basics readonly-arrays AST Alignment - AST end: { column: 1, line: 11 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [183, 186], loc: { @@ -378,7 +404,9 @@ exports[`AST Fixtures legacy-fixtures basics readonly-arrays AST Alignment - AST params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'arr', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeOperator { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-tuples/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-tuples/snapshots/1-TSESTree-AST.shot index 5635686479b..9dc711a43c5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-tuples/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-tuples/snapshots/1-TSESTree-AST.shot @@ -20,7 +20,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: Array [], name: "pair", + optional: false, range: [135, 139], loc: { @@ -53,7 +55,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "console", + optional: false, range: [123, 130], loc: { @@ -64,7 +68,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "log", + optional: false, range: [131, 134], loc: { @@ -103,7 +109,9 @@ Program { computed: true, object: Identifier { type: "Identifier", + decorators: Array [], name: "pair", + optional: false, range: [155, 159], loc: { @@ -164,11 +172,14 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [82, 85], loc: { @@ -179,7 +190,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "pair", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeOperator { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-tuples/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-tuples/snapshots/5-AST-Alignment-AST.shot index 19033edfa0d..509eb2829c1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-tuples/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/readonly-tuples/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,271 @@ exports[`AST Fixtures legacy-fixtures basics readonly-tuples AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [ + MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'pair', +- optional: false, + + range: [135, 139], + loc: { + start: { column: 14, line: 4 }, + end: { column: 18, line: 4 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '0', + value: 0, + + range: [140, 141], + loc: { + start: { column: 19, line: 4 }, + end: { column: 20, line: 4 }, + }, + }, + + range: [135, 142], + loc: { + start: { column: 14, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + ], + callee: MemberExpression { + type: 'MemberExpression', + computed: false, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'console', +- optional: false, + + range: [123, 130], + loc: { + start: { column: 2, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + optional: false, + property: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'log', +- optional: false, + + range: [131, 134], + loc: { + start: { column: 10, line: 4 }, + end: { column: 13, line: 4 }, + }, + }, + + range: [123, 134], + loc: { + start: { column: 2, line: 4 }, + end: { column: 13, line: 4 }, + }, + }, + optional: false, + + range: [123, 143], + loc: { + start: { column: 2, line: 4 }, + end: { column: 22, line: 4 }, + }, + }, + + range: [123, 144], + loc: { + start: { column: 2, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + ExpressionStatement { + type: 'ExpressionStatement', + expression: AssignmentExpression { + type: 'AssignmentExpression', + left: MemberExpression { + type: 'MemberExpression', + computed: true, + object: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'pair', +- optional: false, + + range: [155, 159], + loc: { + start: { column: 2, line: 5 }, + end: { column: 6, line: 5 }, + }, + }, + optional: false, + property: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [160, 161], + loc: { + start: { column: 7, line: 5 }, + end: { column: 8, line: 5 }, + }, + }, + + range: [155, 162], + loc: { + start: { column: 2, line: 5 }, + end: { column: 9, line: 5 }, + }, + }, + operator: '=', + right: Literal { + type: 'Literal', + raw: '\\\\'hello!\\\\'', + value: 'hello!', + + range: [165, 173], + loc: { + start: { column: 12, line: 5 }, + end: { column: 20, line: 5 }, + }, + }, + + range: [155, 173], + loc: { + start: { column: 2, line: 5 }, + end: { column: 20, line: 5 }, + }, + }, + + range: [155, 174], + loc: { + start: { column: 2, line: 5 }, + end: { column: 21, line: 5 }, + }, + }, + ], + + range: [119, 185], + loc: { + start: { column: 46, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [82, 85], + loc: { + start: { column: 9, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'pair', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeOperator { + type: 'TSTypeOperator', + operator: 'readonly', + typeAnnotation: TSTupleType { + type: 'TSTupleType', + elementTypes: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [102, 108], + loc: { + start: { column: 29, line: 3 }, + end: { column: 35, line: 3 }, + }, + }, + TSStringKeyword { + type: 'TSStringKeyword', + + range: [110, 116], + loc: { + start: { column: 37, line: 3 }, + end: { column: 43, line: 3 }, + }, + }, + ], + + range: [101, 117], + loc: { + start: { column: 28, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + + range: [92, 117], + loc: { + start: { column: 19, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + + range: [90, 117], + loc: { + start: { column: 17, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + + range: [86, 117], + loc: { + start: { column: 13, line: 3 }, + end: { column: 44, line: 3 }, + }, + }, + ], + + range: [73, 185], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 186], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 7 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-and-and/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-and-and/snapshots/1-TSESTree-AST.shot index eb4f0c1cbdb..007ab5577c3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-and-and/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-and-and/snapshots/1-TSESTree-AST.shot @@ -10,7 +10,9 @@ Program { type: "AssignmentExpression", left: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [73, 74], loc: { @@ -21,7 +23,9 @@ Program { operator: "||=", right: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [79, 80], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-and-and/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-and-and/snapshots/5-AST-Alignment-AST.shot index 75095e76894..99a21d3bb10 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-and-and/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-and-and/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,62 @@ exports[`AST Fixtures legacy-fixtures basics short-circuiting-assignment-and-and AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: AssignmentExpression { + type: 'AssignmentExpression', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [73, 74], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, + operator: '||=', + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [79, 80], + loc: { + start: { column: 6, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + + range: [73, 80], + loc: { + start: { column: 0, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + + range: [73, 81], + loc: { + start: { column: 0, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 82], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-or-or/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-or-or/snapshots/1-TSESTree-AST.shot index c0e966557fd..4bcf189dd77 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-or-or/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-or-or/snapshots/1-TSESTree-AST.shot @@ -10,7 +10,9 @@ Program { type: "AssignmentExpression", left: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [73, 74], loc: { @@ -21,7 +23,9 @@ Program { operator: "&&=", right: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [79, 80], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-or-or/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-or-or/snapshots/5-AST-Alignment-AST.shot index 99034f0c682..29af9275803 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-or-or/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-or-or/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,62 @@ exports[`AST Fixtures legacy-fixtures basics short-circuiting-assignment-or-or AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: AssignmentExpression { + type: 'AssignmentExpression', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [73, 74], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, + operator: '&&=', + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [79, 80], + loc: { + start: { column: 6, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + + range: [73, 80], + loc: { + start: { column: 0, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + + range: [73, 81], + loc: { + start: { column: 0, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 82], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-question-question/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-question-question/snapshots/1-TSESTree-AST.shot index e007edefd48..7b663373258 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-question-question/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-question-question/snapshots/1-TSESTree-AST.shot @@ -10,7 +10,9 @@ Program { type: "AssignmentExpression", left: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [73, 74], loc: { @@ -21,7 +23,9 @@ Program { operator: "??=", right: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [79, 80], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-question-question/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-question-question/snapshots/5-AST-Alignment-AST.shot index 225b4642d6d..d54020e37f4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-question-question/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/short-circuiting-assignment-question-question/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,62 @@ exports[`AST Fixtures legacy-fixtures basics short-circuiting-assignment-question-question AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExpressionStatement { + type: 'ExpressionStatement', + expression: AssignmentExpression { + type: 'AssignmentExpression', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [73, 74], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, + operator: '??=', + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [79, 80], + loc: { + start: { column: 6, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + + range: [73, 80], + loc: { + start: { column: 0, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + + range: [73, 81], + loc: { + start: { column: 0, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 82], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/1-TSESTree-AST.shot index b9b06647269..709a6c9171a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/1-TSESTree-AST.shot @@ -17,11 +17,14 @@ Program { end: { column: 42, line: 3 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "test", + optional: false, range: [82, 86], loc: { @@ -32,7 +35,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "abc", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { @@ -68,7 +73,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Map", + optional: false, range: [92, 95], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/5-AST-Alignment-AST.shot index 05b325e0ad0..0f0a99e1336 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/symbol-type-param/snapshots/5-AST-Alignment-AST.shot @@ -21,11 +21,14 @@ exports[`AST Fixtures legacy-fixtures basics symbol-type-param AST Alignment - A end: { column: 42, line: 3 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'test', +- optional: false, range: [82, 86], loc: { @@ -36,7 +39,9 @@ exports[`AST Fixtures legacy-fixtures basics symbol-type-param AST Alignment - A params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'abc', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { @@ -72,7 +77,9 @@ exports[`AST Fixtures legacy-fixtures basics symbol-type-param AST Alignment - A - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Map', +- optional: false, range: [92, 95], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-function-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-function-type/snapshots/1-TSESTree-AST.shot index 22c878c0653..c64710e1bd4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-function-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-function-type/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { assertions: Array [], declaration: TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "TestCallback", + optional: false, range: [85, 97], loc: { @@ -24,7 +27,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-function-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-function-type/snapshots/5-AST-Alignment-AST.shot index 80b2ec22efd..616277e27e3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-function-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-function-type/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-export-funct assertions: Array [], declaration: TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'TestCallback', +- optional: false, range: [85, 97], loc: { @@ -29,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-export-funct + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-object-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-object-type/snapshots/1-TSESTree-AST.shot index 748786cc25e..2363229e237 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-object-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-object-type/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { assertions: Array [], declaration: TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "TestClassProps", + optional: false, range: [85, 99], loc: { @@ -27,7 +30,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "count", + optional: false, range: [106, 111], loc: { @@ -35,6 +40,9 @@ Program { end: { column: 7, line: 4 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-object-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-object-type/snapshots/5-AST-Alignment-AST.shot index c5fc765d0c2..9f9b094633b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-object-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export-object-type/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-export-objec assertions: Array [], declaration: TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'TestClassProps', +- optional: false, range: [85, 99], loc: { @@ -31,7 +34,9 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-export-objec computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'count', +- optional: false, range: [106, 111], loc: { @@ -39,6 +44,9 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-export-objec end: { column: 7, line: 4 }, }, }, +- optional: false, +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export/snapshots/1-TSESTree-AST.shot index 1e784b69eaa..b748ae64526 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { assertions: Array [], declaration: TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "TestAlias", + optional: false, range: [85, 94], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export/snapshots/5-AST-Alignment-AST.shot index c9403c51801..a36c1ee31da 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-export/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-export AST A assertions: Array [], declaration: TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'TestAlias', +- optional: false, range: [85, 94], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/1-TSESTree-AST.shot index 3ef2c4b3537..d32f8c5b191 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Result", + optional: false, range: [78, 84], loc: { @@ -28,7 +31,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [109, 110], loc: { @@ -53,7 +58,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Success", + optional: false, range: [101, 108], loc: { @@ -68,7 +75,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [109, 110], loc: { @@ -102,7 +111,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Failure", + optional: false, range: [114, 121], loc: { @@ -143,7 +154,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [85, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/5-AST-Alignment-AST.shot index 168056ecf87..67a40e53053 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-with-constra body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Result', +- optional: false, range: [78, 84], loc: { @@ -32,7 +35,9 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-with-constra - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [109, 110], - loc: { @@ -57,7 +62,9 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-with-constra - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Success', +- optional: false, range: [101, 108], loc: { @@ -72,7 +79,9 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-with-constra type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [109, 110], loc: { @@ -106,7 +115,9 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-with-constra type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Failure', +- optional: false, range: [114, 121], loc: { @@ -147,7 +158,9 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration-with-constra - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [85, 86], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/1-TSESTree-AST.shot index 34a40d3d5f7..0a0e1000366 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Result", + optional: false, range: [78, 84], loc: { @@ -28,7 +31,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [98, 99], loc: { @@ -53,7 +58,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Success", + optional: false, range: [90, 97], loc: { @@ -68,7 +75,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [98, 99], loc: { @@ -102,7 +111,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Failure", + optional: false, range: [103, 110], loc: { @@ -133,7 +144,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [85, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/5-AST-Alignment-AST.shot index 6e0d8613180..95be17186b5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-declaration/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration AST Alignmen body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Result', +- optional: false, range: [78, 84], loc: { @@ -32,7 +35,9 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration AST Alignmen - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [98, 99], - loc: { @@ -57,7 +62,9 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration AST Alignmen - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Success', +- optional: false, range: [90, 97], loc: { @@ -72,7 +79,9 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration AST Alignmen type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [98, 99], loc: { @@ -106,7 +115,9 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration AST Alignmen type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Failure', +- optional: false, range: [103, 110], loc: { @@ -137,7 +148,9 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-declaration AST Alignmen - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [85, 86], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-object-without-annotation/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-object-without-annotation/snapshots/1-TSESTree-AST.shot index 4db74606bd4..eb6885b6225 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-object-without-annotation/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-object-without-annotation/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [78, 81], loc: { @@ -24,7 +27,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [86, 89], loc: { @@ -32,6 +37,9 @@ Program { end: { column: 16, line: 3 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -62,7 +70,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "baz", + optional: false, range: [99, 102], loc: { @@ -70,6 +80,9 @@ Program { end: { column: 29, line: 3 }, }, }, + optional: false, + readonly: false, + static: false, range: [99, 102], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-object-without-annotation/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-object-without-annotation/snapshots/5-AST-Alignment-AST.shot index f7ab811dca3..21231297b43 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-object-without-annotation/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-alias-object-without-annotation/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,120 @@ exports[`AST Fixtures legacy-fixtures basics type-alias-object-without-annotation AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: 'TSTypeLiteral', + members: Array [ + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [86, 89], + loc: { + start: { column: 13, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [91, 97], + loc: { + start: { column: 18, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + + range: [89, 97], + loc: { + start: { column: 16, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + + range: [86, 98], + loc: { + start: { column: 13, line: 3 }, + end: { column: 25, line: 3 }, + }, + }, + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'baz', +- optional: false, + + range: [99, 102], + loc: { + start: { column: 26, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + + range: [99, 102], + loc: { + start: { column: 26, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + ], + + range: [84, 104], + loc: { + start: { column: 11, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + + range: [73, 105], + loc: { + start: { column: 0, line: 3 }, + end: { column: 32, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 106], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-arrow-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-arrow-function/snapshots/1-TSESTree-AST.shot index 15cdfc47fb7..17cfac4e4a0 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-arrow-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-arrow-function/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "assertString", + optional: false, range: [79, 91], loc: { @@ -49,7 +52,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { @@ -83,7 +88,9 @@ Program { asserts: true, parameterName: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [112, 113], loc: { @@ -121,6 +128,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [73, 131], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-arrow-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-arrow-function/snapshots/5-AST-Alignment-AST.shot index db812258aef..960bd95fdf5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-arrow-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-arrow-function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,152 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-arrow-function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'assertString', +- optional: false, + + range: [79, 91], + loc: { + start: { column: 6, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + init: ArrowFunctionExpression { + type: 'ArrowFunctionExpression', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ReturnStatement { + type: 'ReturnStatement', + argument: null, + + range: [121, 128], + loc: { + start: { column: 2, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + ], + + range: [117, 130], + loc: { + start: { column: 44, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + expression: false, + generator: false, + id: null, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [98, 101], + loc: { + start: { column: 25, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + + range: [96, 101], + loc: { + start: { column: 23, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + + range: [95, 101], + loc: { + start: { column: 22, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypePredicate { + type: 'TSTypePredicate', + asserts: true, + parameterName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [112, 113], + loc: { + start: { column: 39, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + typeAnnotation: null, + + range: [104, 113], + loc: { + start: { column: 31, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + + range: [102, 113], + loc: { + start: { column: 29, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + + range: [94, 130], + loc: { + start: { column: 21, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + + range: [79, 130], + loc: { + start: { column: 6, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [73, 131], + loc: { + start: { column: 0, line: 3 }, + end: { column: 2, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 132], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-function/snapshots/1-TSESTree-AST.shot index 20567f67bba..803f80670aa 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-function/snapshots/1-TSESTree-AST.shot @@ -28,11 +28,14 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "assertsString", + optional: false, range: [82, 95], loc: { @@ -43,7 +46,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { @@ -77,7 +82,9 @@ Program { asserts: true, parameterName: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [113, 114], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-function/snapshots/5-AST-Alignment-AST.shot index ba5f295254c..d3f432622b6 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,129 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ReturnStatement { + type: 'ReturnStatement', + argument: null, + + range: [119, 126], + loc: { + start: { column: 2, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + ], + + range: [115, 128], + loc: { + start: { column: 42, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'assertsString', +- optional: false, + + range: [82, 95], + loc: { + start: { column: 9, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [99, 102], + loc: { + start: { column: 26, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + + range: [97, 102], + loc: { + start: { column: 24, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + + range: [96, 102], + loc: { + start: { column: 23, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypePredicate { + type: 'TSTypePredicate', + asserts: true, + parameterName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [113, 114], + loc: { + start: { column: 40, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + typeAnnotation: null, + + range: [105, 114], + loc: { + start: { column: 32, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + + range: [103, 114], + loc: { + start: { column: 30, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + + range: [73, 128], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 129], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-interface/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-interface/snapshots/1-TSESTree-AST.shot index e9eda1815c3..ca226d7b3e8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-interface/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-interface/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "isString", + optional: false, range: [97, 105], loc: { @@ -23,10 +25,13 @@ Program { }, }, kind: "method", + optional: false, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "node", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { @@ -53,6 +58,7 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypePredicate { @@ -60,7 +66,9 @@ Program { asserts: true, parameterName: Identifier { type: "Identifier", + decorators: Array [], name: "node", + optional: false, range: [126, 130], loc: { @@ -83,6 +91,7 @@ Program { end: { column: 35, line: 4 }, }, }, + static: false, range: [97, 131], loc: { @@ -98,9 +107,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "AssertFoo", + optional: false, range: [83, 92], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-interface/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-interface/snapshots/5-AST-Alignment-AST.shot index 3b65ab51b59..867fc42b1d1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-interface/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-interface/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-interface AST Ali computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'isString', +- optional: false, range: [97, 105], loc: { @@ -27,11 +29,14 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-interface AST Ali }, }, kind: 'method', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'node', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSAnyKeyword { @@ -58,6 +63,7 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-interface AST Ali }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -66,7 +72,9 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-interface AST Ali asserts: true, parameterName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'node', +- optional: false, range: [126, 130], loc: { @@ -89,6 +97,7 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-interface AST Ali end: { column: 35, line: 4 }, }, }, +- static: false, range: [97, 131], loc: { @@ -104,9 +113,13 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-interface AST Ali end: { column: 1, line: 5 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'AssertFoo', +- optional: false, range: [83, 92], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-method/snapshots/1-TSESTree-AST.shot index 1e3f0fff528..da81d867c32 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-method/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "isBar", + optional: false, range: [94, 99], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -49,6 +54,7 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -100,9 +106,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "isBaz", + optional: false, range: [136, 141], loc: { @@ -110,7 +120,9 @@ Program { end: { column: 7, line: 7 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: ArrowFunctionExpression { type: "ArrowFunctionExpression", @@ -191,9 +203,13 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "AssertsFoo", + optional: false, range: [79, 89], loc: { @@ -201,6 +217,7 @@ Program { end: { column: 16, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 184], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-method/snapshots/5-AST-Alignment-AST.shot index 198bf8d2a0a..b416df4adad 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-in-method/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-method AST Alignm body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'isBar', +- optional: false, range: [94, 99], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-method AST Alignm }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -53,6 +58,7 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-method AST Alignm end: { column: 3, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -104,9 +110,13 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-method AST Alignm type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'isBaz', +- optional: false, range: [136, 141], loc: { @@ -114,7 +124,9 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-method AST Alignm end: { column: 7, line: 7 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: ArrowFunctionExpression { type: 'ArrowFunctionExpression', @@ -195,9 +207,13 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-method AST Alignm end: { column: 1, line: 10 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'AssertsFoo', +- optional: false, range: [79, 89], loc: { @@ -205,6 +221,7 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-in-method AST Alignm end: { column: 16, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 184], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-arrow-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-arrow-function/snapshots/1-TSESTree-AST.shot index 75bb5e4c3ed..ac7f4bf3dbd 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-arrow-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-arrow-function/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "assertString", + optional: false, range: [79, 91], loc: { @@ -49,7 +52,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { @@ -83,7 +88,9 @@ Program { asserts: true, parameterName: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [112, 113], loc: { @@ -138,6 +145,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [73, 141], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-arrow-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-arrow-function/snapshots/5-AST-Alignment-AST.shot index c32f552cc73..09c0093329f 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-arrow-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-arrow-function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,169 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-arrow-function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'assertString', +- optional: false, + + range: [79, 91], + loc: { + start: { column: 6, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + init: ArrowFunctionExpression { + type: 'ArrowFunctionExpression', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ReturnStatement { + type: 'ReturnStatement', + argument: null, + + range: [131, 138], + loc: { + start: { column: 2, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + ], + + range: [127, 140], + loc: { + start: { column: 54, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + expression: false, + generator: false, + id: null, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [98, 101], + loc: { + start: { column: 25, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + + range: [96, 101], + loc: { + start: { column: 23, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + + range: [95, 101], + loc: { + start: { column: 22, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypePredicate { + type: 'TSTypePredicate', + asserts: true, + parameterName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [112, 113], + loc: { + start: { column: 39, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [117, 123], + loc: { + start: { column: 44, line: 3 }, + end: { column: 50, line: 3 }, + }, + }, + + range: [117, 123], + loc: { + start: { column: 44, line: 3 }, + end: { column: 50, line: 3 }, + }, + }, + + range: [104, 123], + loc: { + start: { column: 31, line: 3 }, + end: { column: 50, line: 3 }, + }, + }, + + range: [102, 123], + loc: { + start: { column: 29, line: 3 }, + end: { column: 50, line: 3 }, + }, + }, + + range: [94, 140], + loc: { + start: { column: 21, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + + range: [79, 140], + loc: { + start: { column: 6, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [73, 141], + loc: { + start: { column: 0, line: 3 }, + end: { column: 2, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 142], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-function/snapshots/1-TSESTree-AST.shot index 8bbe9504a33..6a9453ecc42 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-function/snapshots/1-TSESTree-AST.shot @@ -28,11 +28,14 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "assertsStringGuard", + optional: false, range: [82, 100], loc: { @@ -43,7 +46,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { @@ -77,7 +82,9 @@ Program { asserts: true, parameterName: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [118, 119], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-function/snapshots/5-AST-Alignment-AST.shot index f26ffee877f..1604dae2c4b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,146 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ReturnStatement { + type: 'ReturnStatement', + argument: null, + + range: [134, 141], + loc: { + start: { column: 2, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, + ], + + range: [130, 143], + loc: { + start: { column: 57, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'assertsStringGuard', +- optional: false, + + range: [82, 100], + loc: { + start: { column: 9, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [104, 107], + loc: { + start: { column: 31, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [102, 107], + loc: { + start: { column: 29, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [101, 107], + loc: { + start: { column: 28, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypePredicate { + type: 'TSTypePredicate', + asserts: true, + parameterName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [118, 119], + loc: { + start: { column: 45, line: 3 }, + end: { column: 46, line: 3 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [123, 129], + loc: { + start: { column: 50, line: 3 }, + end: { column: 56, line: 3 }, + }, + }, + + range: [123, 129], + loc: { + start: { column: 50, line: 3 }, + end: { column: 56, line: 3 }, + }, + }, + + range: [110, 129], + loc: { + start: { column: 37, line: 3 }, + end: { column: 56, line: 3 }, + }, + }, + + range: [108, 129], + loc: { + start: { column: 35, line: 3 }, + end: { column: 56, line: 3 }, + }, + }, + + range: [73, 143], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 144], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-interface/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-interface/snapshots/1-TSESTree-AST.shot index 091fa336e78..3b9f53cc275 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-interface/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-interface/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "isString", + optional: false, range: [97, 105], loc: { @@ -23,10 +25,13 @@ Program { }, }, kind: "method", + optional: false, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "node", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { @@ -53,6 +58,7 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypePredicate { @@ -60,7 +66,9 @@ Program { asserts: true, parameterName: Identifier { type: "Identifier", + decorators: Array [], name: "node", + optional: false, range: [126, 130], loc: { @@ -100,6 +108,7 @@ Program { end: { column: 45, line: 4 }, }, }, + static: false, range: [97, 141], loc: { @@ -115,9 +124,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "AssertFoo", + optional: false, range: [83, 92], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-interface/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-interface/snapshots/5-AST-Alignment-AST.shot index c5d8b48f175..196173c257b 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-interface/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-interface/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-interf computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'isString', +- optional: false, range: [97, 105], loc: { @@ -27,11 +29,14 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-interf }, }, kind: 'method', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'node', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSAnyKeyword { @@ -58,6 +63,7 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-interf }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -66,7 +72,9 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-interf asserts: true, parameterName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'node', +- optional: false, range: [126, 130], loc: { @@ -106,6 +114,7 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-interf end: { column: 45, line: 4 }, }, }, +- static: false, range: [97, 141], loc: { @@ -121,9 +130,13 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-interf end: { column: 1, line: 5 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'AssertFoo', +- optional: false, range: [83, 92], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-method/snapshots/1-TSESTree-AST.shot index a3c5693ed3d..595b0699d45 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-method/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "isBar", + optional: false, range: [94, 99], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -49,6 +54,7 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -117,9 +123,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "isBaz", + optional: false, range: [146, 151], loc: { @@ -127,7 +137,9 @@ Program { end: { column: 7, line: 7 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: ArrowFunctionExpression { type: "ArrowFunctionExpression", @@ -225,9 +237,13 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "AssertsFoo", + optional: false, range: [79, 89], loc: { @@ -235,6 +251,7 @@ Program { end: { column: 16, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 204], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-method/snapshots/5-AST-Alignment-AST.shot index 0477b699d6b..38645b843ab 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-method/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-method body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'isBar', +- optional: false, range: [94, 99], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-method }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -53,6 +58,7 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-method end: { column: 3, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -121,9 +127,13 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-method type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'isBaz', +- optional: false, range: [146, 151], loc: { @@ -131,7 +141,9 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-method end: { column: 7, line: 7 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: ArrowFunctionExpression { type: 'ArrowFunctionExpression', @@ -229,9 +241,13 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-method end: { column: 1, line: 10 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'AssertsFoo', +- optional: false, range: [79, 89], loc: { @@ -239,6 +255,7 @@ exports[`AST Fixtures legacy-fixtures basics type-assertion-with-guard-in-method end: { column: 16, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 204], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-arrow-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-arrow-function/snapshots/1-TSESTree-AST.shot index 76dcf3de2d2..9e9c5b08eb3 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-arrow-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-arrow-function/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "isString", + optional: false, range: [79, 87], loc: { @@ -33,7 +36,9 @@ Program { type: "UnaryExpression", argument: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [133, 134], loc: { @@ -90,7 +95,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { @@ -124,7 +131,9 @@ Program { asserts: false, parameterName: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [100, 101], loc: { @@ -179,6 +188,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [73, 151], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-arrow-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-arrow-function/snapshots/5-AST-Alignment-AST.shot index d53c65828a2..64b9930bd03 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-arrow-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-arrow-function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,212 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-arrow-function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'isString', +- optional: false, + + range: [79, 87], + loc: { + start: { column: 6, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + init: ArrowFunctionExpression { + type: 'ArrowFunctionExpression', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ReturnStatement { + type: 'ReturnStatement', + argument: BinaryExpression { + type: 'BinaryExpression', + left: UnaryExpression { + type: 'UnaryExpression', + argument: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [133, 134], + loc: { + start: { column: 16, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + operator: 'typeof', + prefix: true, + + range: [126, 134], + loc: { + start: { column: 9, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + operator: '===', + right: Literal { + type: 'Literal', + raw: '\\\\'string\\\\'', + value: 'string', + + range: [139, 147], + loc: { + start: { column: 22, line: 4 }, + end: { column: 30, line: 4 }, + }, + }, + + range: [126, 147], + loc: { + start: { column: 9, line: 4 }, + end: { column: 30, line: 4 }, + }, + }, + + range: [119, 148], + loc: { + start: { column: 2, line: 4 }, + end: { column: 31, line: 4 }, + }, + }, + ], + + range: [115, 150], + loc: { + start: { column: 42, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + expression: false, + generator: false, + id: null, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [94, 97], + loc: { + start: { column: 21, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + + range: [92, 97], + loc: { + start: { column: 19, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + + range: [91, 97], + loc: { + start: { column: 18, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypePredicate { + type: 'TSTypePredicate', + asserts: false, + parameterName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [100, 101], + loc: { + start: { column: 27, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [105, 111], + loc: { + start: { column: 32, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [105, 111], + loc: { + start: { column: 32, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [100, 111], + loc: { + start: { column: 27, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [98, 111], + loc: { + start: { column: 25, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [90, 150], + loc: { + start: { column: 17, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + + range: [79, 150], + loc: { + start: { column: 6, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [73, 151], + loc: { + start: { column: 0, line: 3 }, + end: { column: 2, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 152], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-function/snapshots/1-TSESTree-AST.shot index 2bea2721280..2c1f7388853 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-function/snapshots/1-TSESTree-AST.shot @@ -18,7 +18,9 @@ Program { type: "UnaryExpression", argument: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [130, 131], loc: { @@ -69,11 +71,14 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "isString", + optional: false, range: [82, 90], loc: { @@ -84,7 +89,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { @@ -118,7 +125,9 @@ Program { asserts: false, parameterName: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [100, 101], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-function/snapshots/5-AST-Alignment-AST.shot index a14b4cb26df..ba366ca7ed6 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,189 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [ + ReturnStatement { + type: 'ReturnStatement', + argument: BinaryExpression { + type: 'BinaryExpression', + left: UnaryExpression { + type: 'UnaryExpression', + argument: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [130, 131], + loc: { + start: { column: 16, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + operator: 'typeof', + prefix: true, + + range: [123, 131], + loc: { + start: { column: 9, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + operator: '===', + right: Literal { + type: 'Literal', + raw: '\\\\'string\\\\'', + value: 'string', + + range: [136, 144], + loc: { + start: { column: 22, line: 4 }, + end: { column: 30, line: 4 }, + }, + }, + + range: [123, 144], + loc: { + start: { column: 9, line: 4 }, + end: { column: 30, line: 4 }, + }, + }, + + range: [116, 145], + loc: { + start: { column: 2, line: 4 }, + end: { column: 31, line: 4 }, + }, + }, + ], + + range: [112, 147], + loc: { + start: { column: 39, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, +- declare: false, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'isString', +- optional: false, + + range: [82, 90], + loc: { + start: { column: 9, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + params: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [94, 97], + loc: { + start: { column: 21, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + + range: [92, 97], + loc: { + start: { column: 19, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + + range: [91, 97], + loc: { + start: { column: 18, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + ], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypePredicate { + type: 'TSTypePredicate', + asserts: false, + parameterName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [100, 101], + loc: { + start: { column: 27, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [105, 111], + loc: { + start: { column: 32, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [105, 111], + loc: { + start: { column: 32, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [100, 111], + loc: { + start: { column: 27, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [98, 111], + loc: { + start: { column: 25, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [73, 147], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 148], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-interface/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-interface/snapshots/1-TSESTree-AST.shot index 8337484f095..d73764f35da 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-interface/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-interface/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "isString", + optional: false, range: [91, 99], loc: { @@ -23,10 +25,13 @@ Program { }, }, kind: "method", + optional: false, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "node", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { @@ -53,6 +58,7 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypePredicate { @@ -60,7 +66,9 @@ Program { asserts: false, parameterName: Identifier { type: "Identifier", + decorators: Array [], name: "node", + optional: false, range: [112, 116], loc: { @@ -100,6 +108,7 @@ Program { end: { column: 37, line: 4 }, }, }, + static: false, range: [91, 127], loc: { @@ -115,9 +124,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-interface/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-interface/snapshots/5-AST-Alignment-AST.shot index da5fc1fa0ac..86b50d0ea33 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-interface/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-interface/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-interface AST Alignme computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'isString', +- optional: false, range: [91, 99], loc: { @@ -27,11 +29,14 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-interface AST Alignme }, }, kind: 'method', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'node', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSAnyKeyword { @@ -58,6 +63,7 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-interface AST Alignme }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -66,7 +72,9 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-interface AST Alignme asserts: false, parameterName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'node', +- optional: false, range: [112, 116], loc: { @@ -106,6 +114,7 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-interface AST Alignme end: { column: 37, line: 4 }, }, }, +- static: false, range: [91, 127], loc: { @@ -121,9 +130,13 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-interface AST Alignme end: { column: 1, line: 5 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-method/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-method/snapshots/1-TSESTree-AST.shot index 4ca55e047db..401610894e1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-method/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-method/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "isBar", + optional: false, range: [87, 92], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -47,7 +52,9 @@ Program { operator: "instanceof", right: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [140, 143], loc: { @@ -77,6 +84,7 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -145,9 +153,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "isBaz", + optional: false, range: [151, 156], loc: { @@ -155,7 +167,9 @@ Program { end: { column: 7, line: 7 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: ArrowFunctionExpression { type: "ArrowFunctionExpression", @@ -179,7 +193,9 @@ Program { operator: "instanceof", right: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [210, 213], loc: { @@ -281,9 +297,13 @@ Program { end: { column: 1, line: 10 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -291,6 +311,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 221], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-method/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-method/snapshots/5-AST-Alignment-AST.shot index d4b80cfc1c0..6694942a9c1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-method/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-guard-in-method/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-method AST Alignment body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'isBar', +- optional: false, range: [87, 92], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-method AST Alignment }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -51,7 +56,9 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-method AST Alignment operator: 'instanceof', right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [140, 143], loc: { @@ -81,6 +88,7 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-method AST Alignment end: { column: 3, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -149,9 +157,13 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-method AST Alignment type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'isBaz', +- optional: false, range: [151, 156], loc: { @@ -159,7 +171,9 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-method AST Alignment end: { column: 7, line: 7 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: ArrowFunctionExpression { type: 'ArrowFunctionExpression', @@ -183,7 +197,9 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-method AST Alignment operator: 'instanceof', right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [210, 213], loc: { @@ -285,9 +301,13 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-method AST Alignment end: { column: 1, line: 10 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -295,6 +315,7 @@ exports[`AST Fixtures legacy-fixtures basics type-guard-in-method AST Alignment end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 221], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/1-TSESTree-AST.shot index 4e35addc8df..02b5d9027e2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "X", + optional: false, range: [78, 79], loc: { @@ -45,7 +48,9 @@ Program { }, qualifier: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [95, 96], loc: { @@ -110,7 +115,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [82, 83], loc: { @@ -145,7 +152,9 @@ Program { }, qualifier: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [95, 96], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/5-AST-Alignment-AST.shot index 3d2a86f859c..65ff013d7fe 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type-with-type-paramete body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [78, 79], loc: { @@ -49,7 +52,9 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type-with-type-paramete - }, - qualifier: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'B', +- optional: false, - - range: [95, 96], - loc: { @@ -114,7 +119,9 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type-with-type-paramete - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [82, 83], loc: { @@ -153,7 +160,9 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type-with-type-paramete }, qualifier: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [95, 96], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/1-TSESTree-AST.shot index 453dc72677f..5f06a8d0c45 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [78, 79], loc: { @@ -66,9 +69,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [107, 108], loc: { @@ -100,7 +106,9 @@ Program { }, qualifier: Identifier { type: "Identifier", + decorators: Array [], name: "X", + optional: false, range: [123, 124], loc: { @@ -115,7 +123,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Y", + optional: false, range: [125, 126], loc: { @@ -145,7 +155,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Y", + optional: false, range: [125, 126], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/5-AST-Alignment-AST.shot index 3c3c8c23b2f..37e97f347a8 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-import-type/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type AST Alignment - AS body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [78, 79], loc: { @@ -74,9 +77,12 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type AST Alignment - AS }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [107, 108], loc: { @@ -112,14 +118,16 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type AST Alignment - AS }, qualifier: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X', +- optional: false, range: [123, 124], loc: { start: { column: 21, line: 4 }, end: { column: 22, line: 4 }, -- }, -- }, + }, + }, - typeArguments: TSTypeParameterInstantiation { - type: 'TSTypeParameterInstantiation', - params: Array [ @@ -127,7 +135,9 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type AST Alignment - AS - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'Y', +- optional: false, - - range: [125, 126], - loc: { @@ -148,8 +158,8 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type AST Alignment - AS - loc: { - start: { column: 22, line: 4 }, - end: { column: 25, line: 4 }, - }, - }, +- }, +- }, typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ @@ -157,7 +167,9 @@ exports[`AST Fixtures legacy-fixtures basics type-import-type AST Alignment - AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Y', +- optional: false, range: [125, 126], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-export-specifiers/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-export-specifiers/snapshots/1-TSESTree-AST.shot index a34c4a80e3e..525578faf37 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-export-specifiers/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-export-specifiers/snapshots/1-TSESTree-AST.shot @@ -25,7 +25,9 @@ Program { type: "ExportSpecifier", exported: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [87, 88], loc: { @@ -36,7 +38,9 @@ Program { exportKind: "type", local: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [87, 88], loc: { @@ -55,7 +59,9 @@ Program { type: "ExportSpecifier", exported: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [95, 96], loc: { @@ -66,7 +72,9 @@ Program { exportKind: "type", local: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [95, 96], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-export-specifiers/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-export-specifiers/snapshots/5-AST-Alignment-AST.shot index b269b793948..d59de66fe0e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-export-specifiers/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-export-specifiers/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,112 @@ exports[`AST Fixtures legacy-fixtures basics type-only-export-specifiers AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + assertions: Array [], + declaration: null, + exportKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\\\'mod\\\\'', + value: 'mod', + + range: [104, 109], + loc: { + start: { column: 31, line: 3 }, + end: { column: 36, line: 3 }, + }, + }, + specifiers: Array [ + ExportSpecifier { + type: 'ExportSpecifier', + exported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'A', +- optional: false, + + range: [87, 88], + loc: { + start: { column: 14, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + exportKind: 'type', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'A', +- optional: false, + + range: [87, 88], + loc: { + start: { column: 14, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + + range: [82, 88], + loc: { + start: { column: 9, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + ExportSpecifier { + type: 'ExportSpecifier', + exported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'B', +- optional: false, + + range: [95, 96], + loc: { + start: { column: 22, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + exportKind: 'type', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'B', +- optional: false, + + range: [95, 96], + loc: { + start: { column: 22, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + + range: [90, 96], + loc: { + start: { column: 17, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + ], + + range: [73, 110], + loc: { + start: { column: 0, line: 3 }, + end: { column: 37, line: 3 }, + }, + }, + ], + sourceType: 'module', + + range: [73, 111], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-import-specifiers/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-import-specifiers/snapshots/1-TSESTree-AST.shot index 8e636185a48..5e605f95738 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-import-specifiers/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-import-specifiers/snapshots/1-TSESTree-AST.shot @@ -24,7 +24,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [87, 88], loc: { @@ -35,7 +37,9 @@ Program { importKind: "type", local: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [87, 88], loc: { @@ -54,7 +58,9 @@ Program { type: "ImportSpecifier", imported: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [95, 96], loc: { @@ -65,7 +71,9 @@ Program { importKind: "type", local: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [95, 96], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-import-specifiers/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-import-specifiers/snapshots/5-AST-Alignment-AST.shot index c473f9f118e..83cde8c97a1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-import-specifiers/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-only-import-specifiers/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,111 @@ exports[`AST Fixtures legacy-fixtures basics type-only-import-specifiers AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ImportDeclaration { + type: 'ImportDeclaration', + assertions: Array [], + importKind: 'value', + source: Literal { + type: 'Literal', + raw: '\\\\'mod\\\\'', + value: 'mod', + + range: [104, 109], + loc: { + start: { column: 31, line: 3 }, + end: { column: 36, line: 3 }, + }, + }, + specifiers: Array [ + ImportSpecifier { + type: 'ImportSpecifier', + imported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'A', +- optional: false, + + range: [87, 88], + loc: { + start: { column: 14, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + importKind: 'type', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'A', +- optional: false, + + range: [87, 88], + loc: { + start: { column: 14, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + + range: [82, 88], + loc: { + start: { column: 9, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + ImportSpecifier { + type: 'ImportSpecifier', + imported: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'B', +- optional: false, + + range: [95, 96], + loc: { + start: { column: 22, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + importKind: 'type', + local: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'B', +- optional: false, + + range: [95, 96], + loc: { + start: { column: 22, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + + range: [90, 96], + loc: { + start: { column: 17, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + ], + + range: [73, 110], + loc: { + start: { column: 0, line: 3 }, + end: { column: 37, line: 3 }, + }, + }, + ], + sourceType: 'module', + + range: [73, 111], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/1-TSESTree-AST.shot index 94eed9630d2..fd4dafefecb 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,9 +17,13 @@ Program { end: { column: 70, line: 3 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [79, 82], loc: { @@ -26,9 +31,12 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [114, 117], loc: { @@ -43,7 +51,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [128, 129], loc: { @@ -73,7 +83,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [128, 129], loc: { @@ -104,7 +116,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [93, 94], loc: { @@ -137,6 +151,7 @@ Program { }, ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -147,9 +162,13 @@ Program { end: { column: 39, line: 6 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "foo2", + optional: false, range: [150, 154], loc: { @@ -157,9 +176,12 @@ Program { end: { column: 10, line: 4 }, }, }, + implements: Array [], superClass: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [205, 208], loc: { @@ -174,7 +196,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [219, 220], loc: { @@ -204,7 +228,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [219, 220], loc: { @@ -255,7 +281,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [168, 169], loc: { @@ -298,12 +326,15 @@ Program { end: { column: 75, line: 7 }, }, }, + declare: false, extends: Array [ TSInterfaceHeritage { type: "TSInterfaceHeritage", expression: Identifier { type: "Identifier", + decorators: Array [], name: "bar2", + optional: false, range: [280, 284], loc: { @@ -318,7 +349,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [295, 296], loc: { @@ -348,7 +381,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [295, 296], loc: { @@ -381,7 +416,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [245, 248], loc: { @@ -397,7 +434,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [259, 260], loc: { @@ -440,12 +479,15 @@ Program { end: { column: 39, line: 9 }, }, }, + declare: false, extends: Array [ TSInterfaceHeritage { type: "TSInterfaceHeritage", expression: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [373, 376], loc: { @@ -460,7 +502,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [387, 388], loc: { @@ -490,7 +534,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [387, 388], loc: { @@ -523,7 +569,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: Array [], name: "bar2", + optional: false, range: [321, 325], loc: { @@ -559,7 +607,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [336, 337], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/5-AST-Alignment-AST.shot index 61551b391db..14af41c9cbd 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -20,9 +21,13 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A end: { column: 70, line: 3 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [79, 82], loc: { @@ -30,9 +35,12 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [114, 117], loc: { @@ -47,7 +55,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', +- optional: false, - - range: [128, 129], - loc: { @@ -77,7 +87,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [128, 129], loc: { @@ -108,9 +120,10 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', -+ name: 'A', - +- optional: false, +- - range: [93, 94], - loc: { - start: { column: 20, line: 3 }, @@ -118,7 +131,8 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A - }, - }, - out: false, -- ++ name: 'A', + range: [93, 94], loc: { start: { column: 20, line: 3 }, @@ -142,6 +156,7 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A }, ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -152,9 +167,13 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A end: { column: 39, line: 6 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo2', +- optional: false, range: [150, 154], loc: { @@ -162,16 +181,19 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A end: { column: 10, line: 4 }, }, }, +- implements: Array [], superClass: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [205, 208], loc: { start: { column: 10, line: 6 }, end: { column: 13, line: 6 }, -- }, -- }, + }, + }, - superTypeArguments: TSTypeParameterInstantiation { - type: 'TSTypeParameterInstantiation', - params: Array [ @@ -179,7 +201,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', +- optional: false, - - range: [219, 220], - loc: { @@ -200,8 +224,8 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A - loc: { - start: { column: 13, line: 6 }, - end: { column: 36, line: 6 }, - }, - }, +- }, +- }, superTypeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ @@ -209,7 +233,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [219, 220], loc: { @@ -260,8 +286,11 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', -- +- optional: false, ++ name: 'A', + - range: [168, 169], - loc: { - start: { column: 12, line: 5 }, @@ -269,8 +298,7 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A - }, - }, - out: false, -+ name: 'A', - +- range: [168, 183], loc: { start: { column: 12, line: 5 }, @@ -304,6 +332,7 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A end: { column: 75, line: 7 }, }, }, +- declare: false, extends: Array [ - TSInterfaceHeritage { - type: 'TSInterfaceHeritage', @@ -311,14 +340,16 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar2', +- optional: false, range: [280, 284], loc: { start: { column: 45, line: 7 }, end: { column: 49, line: 7 }, -- }, -- }, + }, + }, - typeArguments: TSTypeParameterInstantiation { - type: 'TSTypeParameterInstantiation', - params: Array [ @@ -326,7 +357,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', +- optional: false, - - range: [295, 296], - loc: { @@ -347,8 +380,8 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A - loc: { - start: { column: 49, line: 7 }, - end: { column: 72, line: 7 }, - }, - }, +- }, +- }, typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ @@ -356,7 +389,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [295, 296], loc: { @@ -389,7 +424,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A ], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [245, 248], loc: { @@ -405,8 +442,11 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', -- +- optional: false, ++ name: 'A', + - range: [259, 260], - loc: { - start: { column: 24, line: 7 }, @@ -414,8 +454,7 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A - }, - }, - out: false, -+ name: 'A', - +- range: [259, 260], loc: { start: { column: 24, line: 7 }, @@ -449,6 +488,7 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A end: { column: 39, line: 9 }, }, }, +- declare: false, extends: Array [ - TSInterfaceHeritage { - type: 'TSInterfaceHeritage', @@ -456,7 +496,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A + type: 'TSExpressionWithTypeArguments', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [373, 376], loc: { @@ -471,7 +513,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', +- optional: false, - - range: [387, 388], - loc: { @@ -501,7 +545,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [387, 388], loc: { @@ -534,7 +580,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A ], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar2', +- optional: false, range: [321, 325], loc: { @@ -570,7 +618,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments-heritage A - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', +- optional: false, - - range: [336, 337], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/1-TSESTree-AST.shot index 19505507e6e..5f07e669fac 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/1-TSESTree-AST.shot @@ -11,7 +11,9 @@ Program { arguments: Array [], callee: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [73, 76], loc: { @@ -27,7 +29,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [93, 94], loc: { @@ -57,7 +61,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [93, 94], loc: { @@ -107,11 +113,14 @@ Program { end: { column: 40, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [124, 127], loc: { @@ -128,7 +137,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [138, 139], loc: { @@ -172,11 +183,14 @@ Program { end: { column: 46, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "baz", + optional: false, range: [165, 168], loc: { @@ -194,7 +208,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [193, 196], loc: { @@ -212,7 +228,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [179, 180], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/5-AST-Alignment-AST.shot index dfa3331ca0d..eb982059d77 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-parameters-comments/snapshots/5-AST-Alignment-AST.shot @@ -15,7 +15,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments AST Alignm arguments: Array [], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [73, 76], loc: { @@ -31,7 +33,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments AST Alignm - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', +- optional: false, - - range: [93, 94], - loc: { @@ -61,7 +65,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments AST Alignm type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [93, 94], loc: { @@ -111,11 +117,14 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments AST Alignm end: { column: 40, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [124, 127], loc: { @@ -132,9 +141,10 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments AST Alignm - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', -+ name: 'A', - +- optional: false, +- - range: [138, 139], - loc: { - start: { column: 23, line: 4 }, @@ -142,7 +152,8 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments AST Alignm - }, - }, - out: false, -- ++ name: 'A', + range: [138, 139], loc: { start: { column: 23, line: 4 }, @@ -177,11 +188,14 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments AST Alignm end: { column: 46, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [165, 168], loc: { @@ -199,7 +213,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments AST Alignm type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [193, 196], loc: { @@ -217,7 +233,9 @@ exports[`AST Fixtures legacy-fixtures basics type-parameters-comments AST Alignm - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', +- optional: false, - - range: [179, 180], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/1-TSESTree-AST.shot index 75dbf16b8c1..c1c0efd7a10 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -13,9 +14,13 @@ Program { type: "PropertyDefinition", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "mBuffers", + optional: false, range: [99, 107], loc: { @@ -23,7 +28,9 @@ Program { end: { column: 10, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -53,7 +60,9 @@ Program { type: "TSQualifiedName", left: Identifier { type: "Identifier", + decorators: Array [], name: "interop", + optional: false, range: [109, 116], loc: { @@ -63,7 +72,9 @@ Program { }, right: Identifier { type: "Identifier", + decorators: Array [], name: "Reference", + optional: false, range: [117, 126], loc: { @@ -128,9 +139,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "AudioBufferList", + optional: false, range: [79, 94], loc: { @@ -138,6 +153,7 @@ Program { end: { column: 21, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 150], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/5-AST-Alignment-AST.shot index 3d1129c5acf..0204d7ccc9c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/type-reference-comments/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures basics type-reference-comments AST Alignme body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -17,9 +18,13 @@ exports[`AST Fixtures legacy-fixtures basics type-reference-comments AST Alignme type: 'PropertyDefinition', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'mBuffers', +- optional: false, range: [99, 107], loc: { @@ -27,7 +32,9 @@ exports[`AST Fixtures legacy-fixtures basics type-reference-comments AST Alignme end: { column: 10, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -57,7 +64,9 @@ exports[`AST Fixtures legacy-fixtures basics type-reference-comments AST Alignme type: 'TSQualifiedName', left: Identifier { type: 'Identifier', +- decorators: Array [], name: 'interop', +- optional: false, range: [109, 116], loc: { @@ -67,7 +76,9 @@ exports[`AST Fixtures legacy-fixtures basics type-reference-comments AST Alignme }, right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Reference', +- optional: false, range: [117, 126], loc: { @@ -132,9 +143,13 @@ exports[`AST Fixtures legacy-fixtures basics type-reference-comments AST Alignme end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'AudioBufferList', +- optional: false, range: [79, 94], loc: { @@ -142,6 +157,7 @@ exports[`AST Fixtures legacy-fixtures basics type-reference-comments AST Alignme end: { column: 21, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 150], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-bigint/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-bigint/snapshots/1-TSESTree-AST.shot index 7bc28435bab..a946e3eac1d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-bigint/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-bigint/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-bigint/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-bigint/snapshots/5-AST-Alignment-AST.shot index bba1fc6c6f9..c9a2c6c1323 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-bigint/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-bigint/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-bigint AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSBigIntKeyword { + type: 'TSBigIntKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-boolean/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-boolean/snapshots/1-TSESTree-AST.shot index 30579fe3323..aa5b3e72005 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-boolean/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-boolean/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-boolean/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-boolean/snapshots/5-AST-Alignment-AST.shot index 26e84868cf5..f65e128096a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-boolean/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-boolean/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-boolean AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSBooleanKeyword { + type: 'TSBooleanKeyword', + + range: [84, 91], + loc: { + start: { column: 11, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 93], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-false/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-false/snapshots/1-TSESTree-AST.shot index d00e785e0e3..06971d5b01c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-false/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-false/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-false/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-false/snapshots/5-AST-Alignment-AST.shot index d96b38d76a7..53aebf916f5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-false/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-false/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,61 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-false AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: 'false', + value: false, + + range: [84, 89], + loc: { + start: { column: 11, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + + range: [84, 89], + loc: { + start: { column: 11, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + + range: [73, 90], + loc: { + start: { column: 0, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-never/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-never/snapshots/1-TSESTree-AST.shot index 1dca9610fe6..a41ac56146a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-never/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-never/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-never/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-never/snapshots/5-AST-Alignment-AST.shot index c377742b959..a353497f2ec 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-never/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-never/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-never AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSNeverKeyword { + type: 'TSNeverKeyword', + + range: [84, 89], + loc: { + start: { column: 11, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + + range: [73, 90], + loc: { + start: { column: 0, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/1-TSESTree-AST.shot index 3e43912a396..de4277f8890 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/5-AST-Alignment-AST.shot index fca6050d833..466b4987dd4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-null/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-null AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSNullKeyword { + type: 'TSNullKeyword', + + range: [84, 88], + loc: { + start: { column: 11, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + + range: [73, 89], + loc: { + start: { column: 0, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 90], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-number/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-number/snapshots/1-TSESTree-AST.shot index cf951e399b7..b54d9636baa 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-number/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-number/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-number/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-number/snapshots/5-AST-Alignment-AST.shot index 8eb6a37462b..8055f6f1ce2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-number/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-number/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-number AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-object/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-object/snapshots/1-TSESTree-AST.shot index 459a6185563..4358ef0a4d5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-object/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-object/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-object/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-object/snapshots/5-AST-Alignment-AST.shot index 1989928fcdf..29d534bf394 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-object/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-object/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-object AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSObjectKeyword { + type: 'TSObjectKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-string/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-string/snapshots/1-TSESTree-AST.shot index 50520103c36..2a0287f3771 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-string/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-string/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-string/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-string/snapshots/5-AST-Alignment-AST.shot index 5eca842524b..feafd389646 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-string/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-string/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-string AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-symbol/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-symbol/snapshots/1-TSESTree-AST.shot index d4bde83529c..c4ae56b1e30 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-symbol/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-symbol/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-symbol/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-symbol/snapshots/5-AST-Alignment-AST.shot index 8b7dfb95fb3..beffde570e4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-symbol/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-symbol/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-symbol AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSSymbolKeyword { + type: 'TSSymbolKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-true/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-true/snapshots/1-TSESTree-AST.shot index 671689fbe2c..ede03614b17 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-true/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-true/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-true/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-true/snapshots/5-AST-Alignment-AST.shot index c25d16a9d1b..5ee73a232e1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-true/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-true/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,61 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-true AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: 'true', + value: true, + + range: [84, 88], + loc: { + start: { column: 11, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + + range: [84, 88], + loc: { + start: { column: 11, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + + range: [73, 89], + loc: { + start: { column: 0, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 90], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-undefined/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-undefined/snapshots/1-TSESTree-AST.shot index cb70a31ba28..ab3d3eaea51 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-undefined/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-undefined/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-undefined/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-undefined/snapshots/5-AST-Alignment-AST.shot index 6ed7dcc09d3..9756a5a473e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-undefined/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-undefined/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-undefined AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSUndefinedKeyword { + type: 'TSUndefinedKeyword', + + range: [84, 93], + loc: { + start: { column: 11, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 95], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-unknown/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-unknown/snapshots/1-TSESTree-AST.shot index acc1dccfd23..40717b9e9db 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-unknown/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-unknown/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-unknown/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-unknown/snapshots/5-AST-Alignment-AST.shot index a2c14932bd7..3c694ea56b1 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-unknown/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-unknown/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-unknown AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSUnknownKeyword { + type: 'TSUnknownKeyword', + + range: [84, 91], + loc: { + start: { column: 11, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 93], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-void/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-void/snapshots/1-TSESTree-AST.shot index 126b4f0beaa..100eb8b6823 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-void/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-void/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-void/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-void/snapshots/5-AST-Alignment-AST.shot index 8b70a69a9c1..8310c147a49 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-void/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-keyword-void/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures basics typed-keyword-void AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSVoidKeyword { + type: 'TSVoidKeyword', + + range: [84, 88], + loc: { + start: { column: 11, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + + range: [73, 89], + loc: { + start: { column: 0, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 90], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-method-signature/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-method-signature/snapshots/1-TSESTree-AST.shot index a1143b8b44c..040e161711a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-method-signature/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-method-signature/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [78, 81], loc: { @@ -24,7 +27,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "h", + optional: false, range: [88, 89], loc: { @@ -33,10 +38,13 @@ Program { }, }, kind: "method", + optional: false, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -63,6 +71,7 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSVoidKeyword { @@ -81,6 +90,7 @@ Program { end: { column: 22, line: 4 }, }, }, + static: false, range: [88, 109], loc: { @@ -93,7 +103,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "g", + optional: false, range: [112, 113], loc: { @@ -102,17 +114,22 @@ Program { }, }, kind: "method", + optional: false, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [122, 123], loc: { @@ -142,13 +159,16 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [126, 127], loc: { @@ -170,6 +190,7 @@ Program { end: { column: 17, line: 5 }, }, }, + static: false, typeParameters: TSTypeParameterDeclaration { type: "TSTypeParameterDeclaration", params: Array [ @@ -178,7 +199,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [114, 115], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-method-signature/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-method-signature/snapshots/5-AST-Alignment-AST.shot index 8d86878a9bc..7ad4c684213 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-method-signature/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-method-signature/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [78, 81], loc: { @@ -28,7 +31,9 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'h', +- optional: false, range: [88, 89], loc: { @@ -37,11 +42,14 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen }, }, kind: 'method', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -68,6 +76,7 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -87,6 +96,7 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen end: { column: 22, line: 4 }, }, }, +- static: false, range: [88, 109], loc: { @@ -99,7 +109,9 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'g', +- optional: false, range: [112, 113], loc: { @@ -108,18 +120,23 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen }, }, kind: 'method', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [122, 123], loc: { @@ -149,6 +166,7 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -156,7 +174,9 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [126, 127], loc: { @@ -178,6 +198,7 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen end: { column: 17, line: 5 }, }, }, +- static: false, typeParameters: TSTypeParameterDeclaration { type: 'TSTypeParameterDeclaration', params: Array [ @@ -186,7 +207,9 @@ exports[`AST Fixtures legacy-fixtures basics typed-method-signature AST Alignmen - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [114, 115], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/1-TSESTree-AST.shot index f3369540a94..b4aa9d9e6c9 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "addClickListener", + optional: false, range: [97, 113], loc: { @@ -23,10 +25,13 @@ Program { }, }, kind: "method", + optional: false, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "onclick", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSFunctionType { @@ -34,7 +39,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "this", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSVoidKeyword { @@ -62,14 +69,18 @@ Program { }, Identifier { type: "Identifier", + decorators: Array [], name: "e", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Event", + optional: false, range: [139, 144], loc: { @@ -139,6 +150,7 @@ Program { }, }, ], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSVoidKeyword { @@ -157,6 +169,7 @@ Program { end: { column: 65, line: 4 }, }, }, + static: false, range: [97, 161], loc: { @@ -172,9 +185,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "UIElement", + optional: false, range: [83, 92], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/5-AST-Alignment-AST.shot index 6b66408fdf8..71878cff80a 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/typed-this/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures basics typed-this AST Alignment - AST 1`] computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'addClickListener', +- optional: false, range: [97, 113], loc: { @@ -27,11 +29,14 @@ exports[`AST Fixtures legacy-fixtures basics typed-this AST Alignment - AST 1`] }, }, kind: 'method', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'onclick', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSFunctionType { @@ -40,7 +45,9 @@ exports[`AST Fixtures legacy-fixtures basics typed-this AST Alignment - AST 1`] + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'this', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSVoidKeyword { @@ -68,14 +75,18 @@ exports[`AST Fixtures legacy-fixtures basics typed-this AST Alignment - AST 1`] }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'e', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Event', +- optional: false, range: [139, 144], loc: { @@ -146,6 +157,7 @@ exports[`AST Fixtures legacy-fixtures basics typed-this AST Alignment - AST 1`] }, }, ], +- readonly: false, - returnType: TSTypeAnnotation { + typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -165,6 +177,7 @@ exports[`AST Fixtures legacy-fixtures basics typed-this AST Alignment - AST 1`] end: { column: 65, line: 4 }, }, }, +- static: false, range: [97, 161], loc: { @@ -180,9 +193,13 @@ exports[`AST Fixtures legacy-fixtures basics typed-this AST Alignment - AST 1`] end: { column: 1, line: 5 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'UIElement', +- optional: false, range: [83, 92], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/1-TSESTree-AST.shot index 25f8bed4a1d..fb5ec807cef 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "union", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnionType { @@ -75,6 +78,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 110], @@ -88,9 +92,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "intersection", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSIntersectionType { @@ -145,6 +152,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [111, 145], @@ -158,9 +166,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "precedence1", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnionType { @@ -235,6 +246,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [146, 191], @@ -248,9 +260,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "precedence2", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnionType { @@ -325,6 +340,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [192, 237], @@ -335,9 +351,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "unionLeading", + optional: false, range: [244, 256], loc: { @@ -383,9 +402,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "intersectionLeading", + optional: false, range: [281, 300], loc: { @@ -431,9 +453,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "unionLeadingSingle", + optional: false, range: [325, 343], loc: { @@ -459,9 +484,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "intersectionLeadingSingle", + optional: false, range: [359, 384], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/5-AST-Alignment-AST.shot index 003d20be443..0ba46d85e33 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/union-intersection/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'union', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSUnionType { @@ -79,6 +82,7 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - }, }, ], +- declare: false, kind: 'let', range: [73, 110], @@ -92,9 +96,12 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'intersection', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSIntersectionType { @@ -149,6 +156,7 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - }, }, ], +- declare: false, kind: 'let', range: [111, 145], @@ -162,9 +170,12 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'precedence1', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSUnionType { @@ -268,6 +279,7 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - }, }, ], +- declare: false, kind: 'let', range: [146, 191], @@ -281,9 +293,12 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'precedence2', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSUnionType { @@ -387,6 +402,7 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - }, }, ], +- declare: false, kind: 'let', range: [192, 237], @@ -397,9 +413,12 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'unionLeading', +- optional: false, range: [244, 256], loc: { @@ -445,9 +464,12 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'intersectionLeading', +- optional: false, range: [281, 300], loc: { @@ -493,9 +515,12 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'unionLeadingSingle', +- optional: false, range: [325, 343], loc: { @@ -521,9 +546,12 @@ exports[`AST Fixtures legacy-fixtures basics union-intersection AST Alignment - }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'intersectionLeadingSingle', +- optional: false, range: [359, 384], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unique-symbol/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unique-symbol/snapshots/1-TSESTree-AST.shot index 82249db517a..cc4ed4eaad6 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unique-symbol/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unique-symbol/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [78, 79], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unique-symbol/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unique-symbol/snapshots/5-AST-Alignment-AST.shot index 624e3a6347f..6c182a3ea16 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unique-symbol/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unique-symbol/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,60 @@ exports[`AST Fixtures legacy-fixtures basics unique-symbol AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'A', +- optional: false, + + range: [78, 79], + loc: { + start: { column: 5, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + typeAnnotation: TSTypeOperator { + type: 'TSTypeOperator', + operator: 'unique', + typeAnnotation: TSSymbolKeyword { + type: 'TSSymbolKeyword', + + range: [89, 95], + loc: { + start: { column: 16, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + + range: [82, 95], + loc: { + start: { column: 9, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + + range: [73, 96], + loc: { + start: { column: 0, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 97], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unknown-type-annotation/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unknown-type-annotation/snapshots/1-TSESTree-AST.shot index 943a5122c5b..b579bae77e4 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unknown-type-annotation/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unknown-type-annotation/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnknownKeyword { @@ -46,6 +49,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 90], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unknown-type-annotation/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unknown-type-annotation/snapshots/5-AST-Alignment-AST.shot index 9a02cb1d49f..eca7ce1e22c 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unknown-type-annotation/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/unknown-type-annotation/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,73 @@ exports[`AST Fixtures legacy-fixtures basics unknown-type-annotation AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSUnknownKeyword { + type: 'TSUnknownKeyword', + + range: [82, 89], + loc: { + start: { column: 9, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + + range: [80, 89], + loc: { + start: { column: 7, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + + range: [77, 89], + loc: { + start: { column: 4, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + init: null, + + range: [77, 89], + loc: { + start: { column: 4, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 90], + loc: { + start: { column: 0, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-dotted-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-dotted-type/snapshots/1-TSESTree-AST.shot index 9e08e2b404d..d3326aff2c2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-dotted-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-dotted-type/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { @@ -22,7 +25,9 @@ Program { type: "TSQualifiedName", left: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [82, 83], loc: { @@ -32,7 +37,9 @@ Program { }, right: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [84, 85], loc: { @@ -49,7 +56,9 @@ Program { }, right: Identifier { type: "Identifier", + decorators: Array [], name: "C", + optional: false, range: [86, 87], loc: { @@ -94,6 +103,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [73, 88], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-dotted-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-dotted-type/snapshots/5-AST-Alignment-AST.shot index c7abbe04267..d389263137d 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-dotted-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-dotted-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,127 @@ exports[`AST Fixtures legacy-fixtures basics var-with-dotted-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', + typeName: TSQualifiedName { + type: 'TSQualifiedName', + left: TSQualifiedName { + type: 'TSQualifiedName', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'A', +- optional: false, + + range: [82, 83], + loc: { + start: { column: 9, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'B', +- optional: false, + + range: [84, 85], + loc: { + start: { column: 11, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + + range: [82, 85], + loc: { + start: { column: 9, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'C', +- optional: false, + + range: [86, 87], + loc: { + start: { column: 13, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [82, 87], + loc: { + start: { column: 9, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [82, 87], + loc: { + start: { column: 9, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [80, 87], + loc: { + start: { column: 7, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [77, 87], + loc: { + start: { column: 4, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + init: null, + + range: [77, 87], + loc: { + start: { column: 4, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [73, 88], + loc: { + start: { column: 0, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 89], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-type/snapshots/1-TSESTree-AST.shot index 62ba003935b..e669345f4e2 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-type/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "name", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -56,6 +59,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [73, 103], @@ -69,9 +73,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -116,6 +123,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [104, 128], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-type/snapshots/5-AST-Alignment-AST.shot index 5db71f16938..85ec47dfecb 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/var-with-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,147 @@ exports[`AST Fixtures legacy-fixtures basics var-with-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'name', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [83, 89], + loc: { + start: { column: 10, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + + range: [81, 89], + loc: { + start: { column: 8, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + + range: [77, 89], + loc: { + start: { column: 4, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '\\\\'Nicholas\\\\'', + value: 'Nicholas', + + range: [92, 102], + loc: { + start: { column: 19, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + + range: [77, 102], + loc: { + start: { column: 4, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [73, 103], + loc: { + start: { column: 0, line: 3 }, + end: { column: 30, line: 3 }, + }, + }, + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [113, 119], + loc: { + start: { column: 9, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + + range: [111, 119], + loc: { + start: { column: 7, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + + range: [108, 119], + loc: { + start: { column: 4, line: 4 }, + end: { column: 15, line: 4 }, + }, + }, + init: Literal { + type: 'Literal', + raw: '\\\\'Bar\\\\'', + value: 'Bar', + + range: [122, 127], + loc: { + start: { column: 18, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + + range: [108, 127], + loc: { + start: { column: 4, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + ], +- declare: false, + kind: 'var', + + range: [104, 128], + loc: { + start: { column: 0, line: 4 }, + end: { column: 24, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 129], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/snapshots/1-TSESTree-AST.shot index 1f0975e69f9..033b86813d5 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -46,6 +49,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 87], diff --git a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/snapshots/5-AST-Alignment-AST.shot index e4933e5c280..27a1d0f281e 100644 --- a/packages/ast-spec/src/legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,73 @@ exports[`AST Fixtures legacy-fixtures basics variable-declaration-type-annotation-spacing AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [80, 86], + loc: { + start: { column: 7, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [78, 86], + loc: { + start: { column: 5, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + + range: [77, 86], + loc: { + start: { column: 4, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + init: null, + + range: [77, 86], + loc: { + start: { column: 4, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 87], + loc: { + start: { column: 0, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 88], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator-factory/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator-factory/snapshots/1-TSESTree-AST.shot index 11c4c7d84f3..bb3c0d2f54f 100644 --- a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator-factory/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator-factory/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,6 +17,7 @@ Program { end: { column: 21, line: 6 }, }, }, + declare: false, decorators: Array [ Decorator { type: "Decorator", @@ -30,7 +32,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "selector", + optional: false, range: [88, 96], loc: { @@ -40,6 +44,7 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: false, value: Literal { type: "Literal", @@ -70,7 +75,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: Array [], name: "Component", + optional: false, range: [74, 83], loc: { @@ -96,7 +103,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: Array [], name: "FooComponent", + optional: false, range: [114, 126], loc: { @@ -104,6 +113,7 @@ Program { end: { column: 18, line: 6 }, }, }, + implements: Array [], superClass: null, range: [73, 129], diff --git a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator-factory/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator-factory/snapshots/5-AST-Alignment-AST.shot index 8c120b192b5..2f8686ef907 100644 --- a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator-factory/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator-factory/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,137 @@ exports[`AST Fixtures legacy-fixtures class-decorators class-decorator-factory AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [127, 129], + loc: { + start: { column: 19, line: 6 }, + end: { column: 21, line: 6 }, + }, + }, +- declare: false, + decorators: Array [ + Decorator { + type: 'Decorator', + expression: CallExpression { + type: 'CallExpression', + arguments: Array [ + ObjectExpression { + type: 'ObjectExpression', + properties: Array [ + Property { + type: 'Property', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'selector', +- optional: false, + + range: [88, 96], + loc: { + start: { column: 2, line: 4 }, + end: { column: 10, line: 4 }, + }, + }, + kind: 'init', + method: false, +- optional: false, + shorthand: false, + value: Literal { + type: 'Literal', + raw: '\\\\'foo\\\\'', + value: 'foo', + + range: [98, 103], + loc: { + start: { column: 12, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + + range: [88, 103], + loc: { + start: { column: 2, line: 4 }, + end: { column: 17, line: 4 }, + }, + }, + ], + + range: [84, 106], + loc: { + start: { column: 11, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + ], + callee: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Component', +- optional: false, + + range: [74, 83], + loc: { + start: { column: 1, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + optional: false, + + range: [74, 107], + loc: { + start: { column: 1, line: 3 }, + end: { column: 2, line: 5 }, + }, + }, + + range: [73, 107], + loc: { + start: { column: 0, line: 3 }, + end: { column: 2, line: 5 }, + }, + }, + ], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'FooComponent', +- optional: false, + + range: [114, 126], + loc: { + start: { column: 6, line: 6 }, + end: { column: 18, line: 6 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [73, 129], + loc: { + start: { column: 0, line: 3 }, + end: { column: 21, line: 6 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 130], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 7 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator/snapshots/1-TSESTree-AST.shot index f1c3785e60b..74f8a91927d 100644 --- a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -16,12 +17,15 @@ Program { end: { column: 12, line: 4 }, }, }, + declare: false, decorators: Array [ Decorator { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: Array [], name: "sealed", + optional: false, range: [74, 80], loc: { @@ -39,7 +43,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: Array [], name: "Qux", + optional: false, range: [87, 90], loc: { @@ -47,6 +53,7 @@ Program { end: { column: 9, line: 4 }, }, }, + implements: Array [], superClass: null, range: [73, 93], diff --git a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator/snapshots/5-AST-Alignment-AST.shot index 40e0a52e409..1b6b38c2c77 100644 --- a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-decorator/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,77 @@ exports[`AST Fixtures legacy-fixtures class-decorators class-decorator AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [91, 93], + loc: { + start: { column: 10, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, +- declare: false, + decorators: Array [ + Decorator { + type: 'Decorator', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'sealed', +- optional: false, + + range: [74, 80], + loc: { + start: { column: 1, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + + range: [73, 80], + loc: { + start: { column: 0, line: 3 }, + end: { column: 7, line: 3 }, + }, + }, + ], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Qux', +- optional: false, + + range: [87, 90], + loc: { + start: { column: 6, line: 4 }, + end: { column: 9, line: 4 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [73, 93], + loc: { + start: { column: 0, line: 3 }, + end: { column: 12, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-parameter-property/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-parameter-property/snapshots/1-TSESTree-AST.shot index cebfd84330a..1ac79d701f9 100644 --- a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-parameter-property/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-parameter-property/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "constructor", + optional: false, range: [85, 96], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 38, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -50,7 +56,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: Array [], name: "d", + optional: false, range: [98, 99], loc: { @@ -66,9 +74,12 @@ Program { }, }, ], + override: false, parameter: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -94,6 +105,8 @@ Program { end: { column: 34, line: 4 }, }, }, + readonly: false, + static: false, range: [97, 117], loc: { @@ -124,9 +137,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [79, 80], loc: { @@ -134,6 +151,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 123], diff --git a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-parameter-property/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-parameter-property/snapshots/5-AST-Alignment-AST.shot index ad0a3b6af28..b5b95884e0e 100644 --- a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-parameter-property/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/class-parameter-property/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures class-decorators class-parameter-property body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [85, 96], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures class-decorators class-parameter-property }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures class-decorators class-parameter-property end: { column: 38, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -54,7 +60,9 @@ exports[`AST Fixtures legacy-fixtures class-decorators class-parameter-property type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'd', +- optional: false, range: [98, 99], loc: { @@ -70,9 +78,12 @@ exports[`AST Fixtures legacy-fixtures class-decorators class-parameter-property }, }, ], +- override: false, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -98,6 +109,8 @@ exports[`AST Fixtures legacy-fixtures class-decorators class-parameter-property end: { column: 34, line: 4 }, }, }, +- readonly: false, +- static: false, - range: [97, 117], + range: [100, 117], @@ -130,9 +143,13 @@ exports[`AST Fixtures legacy-fixtures class-decorators class-parameter-property end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [79, 80], loc: { @@ -140,6 +157,7 @@ exports[`AST Fixtures legacy-fixtures class-decorators class-parameter-property end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 123], diff --git a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-default-class-decorator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-default-class-decorator/snapshots/1-TSESTree-AST.shot index 90813124a39..bfae7882a5b 100644 --- a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-default-class-decorator/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-default-class-decorator/snapshots/1-TSESTree-AST.shot @@ -8,6 +8,7 @@ Program { type: "ExportDefaultDeclaration", declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -18,12 +19,15 @@ Program { end: { column: 27, line: 4 }, }, }, + declare: false, decorators: Array [ Decorator { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: Array [], name: "sealed", + optional: false, range: [74, 80], loc: { @@ -41,7 +45,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: Array [], name: "Qux", + optional: false, range: [102, 105], loc: { @@ -49,6 +55,7 @@ Program { end: { column: 24, line: 4 }, }, }, + implements: Array [], superClass: null, range: [96, 108], diff --git a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-default-class-decorator/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-default-class-decorator/snapshots/5-AST-Alignment-AST.shot index aab5207c1cf..e0c2bb34c55 100644 --- a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-default-class-decorator/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-default-class-decorator/snapshots/5-AST-Alignment-AST.shot @@ -12,6 +12,7 @@ exports[`AST Fixtures legacy-fixtures class-decorators export-default-class-deco type: 'ExportDefaultDeclaration', declaration: ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -22,12 +23,15 @@ exports[`AST Fixtures legacy-fixtures class-decorators export-default-class-deco end: { column: 27, line: 4 }, }, }, +- declare: false, decorators: Array [ Decorator { type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'sealed', +- optional: false, range: [74, 80], loc: { @@ -45,7 +49,9 @@ exports[`AST Fixtures legacy-fixtures class-decorators export-default-class-deco ], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Qux', +- optional: false, range: [102, 105], loc: { @@ -53,6 +59,7 @@ exports[`AST Fixtures legacy-fixtures class-decorators export-default-class-deco end: { column: 24, line: 4 }, }, }, +- implements: Array [], superClass: null, - range: [96, 108], diff --git a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-named-class-decorator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-named-class-decorator/snapshots/1-TSESTree-AST.shot index e1fe4ea39ea..775c286ada6 100644 --- a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-named-class-decorator/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-named-class-decorator/snapshots/1-TSESTree-AST.shot @@ -9,6 +9,7 @@ Program { assertions: Array [], declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -19,12 +20,15 @@ Program { end: { column: 19, line: 4 }, }, }, + declare: false, decorators: Array [ Decorator { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: Array [], name: "sealed", + optional: false, range: [74, 80], loc: { @@ -42,7 +46,9 @@ Program { ], id: Identifier { type: "Identifier", + decorators: Array [], name: "Qux", + optional: false, range: [94, 97], loc: { @@ -50,6 +56,7 @@ Program { end: { column: 16, line: 4 }, }, }, + implements: Array [], superClass: null, range: [88, 100], diff --git a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-named-class-decorator/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-named-class-decorator/snapshots/5-AST-Alignment-AST.shot index 129de117810..d0ef16bd7f4 100644 --- a/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-named-class-decorator/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/class-decorators/fixtures/export-named-class-decorator/snapshots/5-AST-Alignment-AST.shot @@ -13,6 +13,7 @@ exports[`AST Fixtures legacy-fixtures class-decorators export-named-class-decora assertions: Array [], declaration: ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [], @@ -23,12 +24,15 @@ exports[`AST Fixtures legacy-fixtures class-decorators export-named-class-decora end: { column: 19, line: 4 }, }, }, +- declare: false, decorators: Array [ Decorator { type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'sealed', +- optional: false, range: [74, 80], loc: { @@ -46,7 +50,9 @@ exports[`AST Fixtures legacy-fixtures class-decorators export-named-class-decora ], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Qux', +- optional: false, range: [94, 97], loc: { @@ -54,6 +60,7 @@ exports[`AST Fixtures legacy-fixtures class-decorators export-named-class-decora end: { column: 16, line: 4 }, }, }, +- implements: Array [], superClass: null, - range: [88, 100], diff --git a/packages/ast-spec/src/legacy-fixtures/comments/fixtures/type-assertion-regression-test/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/comments/fixtures/type-assertion-regression-test/snapshots/1-TSESTree-AST.shot index 381468f0d2a..e3095a0a420 100644 --- a/packages/ast-spec/src/legacy-fixtures/comments/fixtures/type-assertion-regression-test/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/comments/fixtures/type-assertion-regression-test/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [79, 82], loc: { @@ -23,7 +26,9 @@ Program { type: "TSTypeAssertion", expression: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [102, 105], loc: { @@ -35,7 +40,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [89, 92], loc: { @@ -65,6 +72,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [73, 106], diff --git a/packages/ast-spec/src/legacy-fixtures/comments/fixtures/type-assertion-regression-test/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/comments/fixtures/type-assertion-regression-test/snapshots/5-AST-Alignment-AST.shot index 72f39c2a9d7..e7bfc6ff2f7 100644 --- a/packages/ast-spec/src/legacy-fixtures/comments/fixtures/type-assertion-regression-test/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/comments/fixtures/type-assertion-regression-test/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,96 @@ exports[`AST Fixtures legacy-fixtures comments type-assertion-regression-test AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [79, 82], + loc: { + start: { column: 6, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + init: TSTypeAssertion { + type: 'TSTypeAssertion', + expression: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'bar', +- optional: false, + + range: [102, 105], + loc: { + start: { column: 1, line: 5 }, + end: { column: 4, line: 5 }, + }, + }, + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [89, 92], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + + range: [89, 92], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + + range: [85, 105], + loc: { + start: { column: 12, line: 3 }, + end: { column: 4, line: 5 }, + }, + }, + + range: [79, 105], + loc: { + start: { column: 6, line: 3 }, + end: { column: 4, line: 5 }, + }, + }, + ], +- declare: false, + kind: 'const', + + range: [73, 106], + loc: { + start: { column: 0, line: 3 }, + end: { column: 5, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 107], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/abstract-class/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/abstract-class/snapshots/1-TSESTree-AST.shot index 1754da14fd4..632b1a5218f 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/abstract-class/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/abstract-class/snapshots/1-TSESTree-AST.shot @@ -18,9 +18,12 @@ Program { }, }, declare: true, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [96, 99], loc: { @@ -28,6 +31,7 @@ Program { end: { column: 26, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 102], diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/abstract-class/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/abstract-class/snapshots/5-AST-Alignment-AST.shot index 5af6384c015..2bb556fb9a3 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/abstract-class/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/abstract-class/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures legacy-fixtures declare abstract-class AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + abstract: true, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [100, 102], + loc: { + start: { column: 27, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + declare: true, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [96, 99], + loc: { + start: { column: 23, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [73, 102], + loc: { + start: { column: 0, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 103], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/class/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/class/snapshots/1-TSESTree-AST.shot index 2d0980f45ca..8301c12e2e0 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/class/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/class/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [], @@ -17,9 +18,12 @@ Program { }, }, declare: true, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [87, 90], loc: { @@ -27,6 +31,7 @@ Program { end: { column: 17, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 93], diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/class/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/class/snapshots/5-AST-Alignment-AST.shot index 87f188965e7..88ee83e0881 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/class/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/class/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,55 @@ exports[`AST Fixtures legacy-fixtures declare class AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', +- abstract: false, + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [91, 93], + loc: { + start: { column: 18, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + declare: true, +- decorators: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [87, 90], + loc: { + start: { column: 14, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, +- implements: Array [], + superClass: null, + + range: [73, 93], + loc: { + start: { column: 0, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/1-TSESTree-AST.shot index 8150d53af10..dc0608146cd 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/1-TSESTree-AST.shot @@ -6,10 +6,13 @@ Program { body: Array [ TSEnumDeclaration { type: "TSEnumDeclaration", + const: false, declare: true, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [86, 89], loc: { @@ -20,9 +23,12 @@ Program { members: Array [ TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Bar", + optional: false, range: [94, 97], loc: { @@ -39,9 +45,12 @@ Program { }, TSEnumMember { type: "TSEnumMember", + computed: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Baz", + optional: false, range: [101, 104], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/5-AST-Alignment-AST.shot index be39111033a..1ef1a9d0f0b 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/enum/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,88 @@ exports[`AST Fixtures legacy-fixtures declare enum AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSEnumDeclaration { + type: 'TSEnumDeclaration', +- const: false, + declare: true, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [86, 89], + loc: { + start: { column: 13, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + members: Array [ + TSEnumMember { + type: 'TSEnumMember', +- computed: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Bar', +- optional: false, + + range: [94, 97], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + + range: [94, 97], + loc: { + start: { column: 2, line: 4 }, + end: { column: 5, line: 4 }, + }, + }, + TSEnumMember { + type: 'TSEnumMember', +- computed: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Baz', +- optional: false, + + range: [101, 104], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + + range: [101, 104], + loc: { + start: { column: 2, line: 5 }, + end: { column: 5, line: 5 }, + }, + }, + ], + + range: [73, 107], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 6 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 108], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 7 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/function/snapshots/1-TSESTree-AST.shot index 5d3548cb2ae..0ed61998e32 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/function/snapshots/1-TSESTree-AST.shot @@ -12,7 +12,9 @@ Program { generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [90, 93], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/function/snapshots/5-AST-Alignment-AST.shot index cef0cfc863e..cd2704357cc 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/function/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,63 @@ exports[`AST Fixtures legacy-fixtures declare function AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [90, 93], + loc: { + start: { column: 17, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + params: Array [], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSVoidKeyword { + type: 'TSVoidKeyword', + + range: [97, 101], + loc: { + start: { column: 24, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + + range: [95, 101], + loc: { + start: { column: 22, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + + range: [73, 102], + loc: { + start: { column: 0, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 103], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/interface/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/interface/snapshots/1-TSESTree-AST.shot index 369f6a7fb53..52a4be05627 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/interface/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/interface/snapshots/1-TSESTree-AST.shot @@ -17,9 +17,12 @@ Program { }, }, declare: true, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [91, 94], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/interface/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/interface/snapshots/5-AST-Alignment-AST.shot index 13fe23e4d2a..fb70f302dcc 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/interface/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/interface/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,52 @@ exports[`AST Fixtures legacy-fixtures declare interface AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSInterfaceDeclaration { + type: 'TSInterfaceDeclaration', + body: TSInterfaceBody { + type: 'TSInterfaceBody', + body: Array [], + + range: [95, 97], + loc: { + start: { column: 22, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + declare: true, +- extends: Array [], + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [91, 94], + loc: { + start: { column: 18, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + + range: [73, 97], + loc: { + start: { column: 0, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 98], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/module/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/module/snapshots/1-TSESTree-AST.shot index 28b9f673edc..e41432d9a64 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/module/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/module/snapshots/1-TSESTree-AST.shot @@ -17,9 +17,12 @@ Program { }, }, declare: true, + global: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [88, 91], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/module/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/module/snapshots/5-AST-Alignment-AST.shot index 575a9a6bd39..5060682c9ee 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/module/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/module/snapshots/5-AST-Alignment-AST.shot @@ -21,9 +21,12 @@ exports[`AST Fixtures legacy-fixtures declare module AST Alignment - AST 1`] = ` }, }, declare: true, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [88, 91], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/1-TSESTree-AST.shot index 131440bf5fe..2540480369a 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/1-TSESTree-AST.shot @@ -17,9 +17,12 @@ Program { }, }, declare: true, + global: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [91, 94], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/5-AST-Alignment-AST.shot index ba41672f843..967347feff5 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/namespace/snapshots/5-AST-Alignment-AST.shot @@ -21,9 +21,12 @@ exports[`AST Fixtures legacy-fixtures declare namespace AST Alignment - AST 1`] }, }, declare: true, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [91, 94], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/type-alias/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/type-alias/snapshots/1-TSESTree-AST.shot index 0df751e2ad8..045b780d7d2 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/type-alias/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/type-alias/snapshots/1-TSESTree-AST.shot @@ -9,7 +9,9 @@ Program { declare: true, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [86, 89], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/type-alias/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/type-alias/snapshots/5-AST-Alignment-AST.shot index d425ca353e6..d47eb9051c4 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/type-alias/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/type-alias/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,50 @@ exports[`AST Fixtures legacy-fixtures declare type-alias AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', + declare: true, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [86, 89], + loc: { + start: { column: 13, line: 3 }, + end: { column: 16, line: 3 }, + }, + }, + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [92, 98], + loc: { + start: { column: 19, line: 3 }, + end: { column: 25, line: 3 }, + }, + }, + + range: [73, 99], + loc: { + start: { column: 0, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 100], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/variable/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/variable/snapshots/1-TSESTree-AST.shot index de3d06244c0..08eaeb07639 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/variable/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/variable/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/variable/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/variable/snapshots/5-AST-Alignment-AST.shot index 3dcece695fe..58499e81b15 100644 --- a/packages/ast-spec/src/legacy-fixtures/declare/fixtures/variable/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/declare/fixtures/variable/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,73 @@ exports[`AST Fixtures legacy-fixtures declare variable AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSAnyKeyword { + type: 'TSAnyKeyword', + + range: [90, 93], + loc: { + start: { column: 17, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [88, 93], + loc: { + start: { column: 15, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [85, 93], + loc: { + start: { column: 12, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + init: null, + + range: [85, 93], + loc: { + start: { column: 12, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + ], + declare: true, + kind: 'var', + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 95], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/1-TSESTree-AST.shot index 1b469748f96..b5c7a0ba6b3 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/1-TSESTree-AST.shot @@ -11,7 +11,9 @@ Program { arguments: Array [], callee: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [73, 76], loc: { @@ -27,7 +29,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [77, 78], loc: { @@ -57,7 +61,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [77, 78], loc: { @@ -101,7 +107,9 @@ Program { arguments: Array [], callee: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot index 967a42b4d8d..90cd92550d8 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot @@ -15,7 +15,9 @@ exports[`AST Fixtures legacy-fixtures expressions call-expression-type-arguments arguments: Array [], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [73, 76], loc: { @@ -31,7 +33,9 @@ exports[`AST Fixtures legacy-fixtures expressions call-expression-type-arguments - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', +- optional: false, - - range: [77, 78], - loc: { @@ -61,7 +65,9 @@ exports[`AST Fixtures legacy-fixtures expressions call-expression-type-arguments type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [77, 78], loc: { @@ -105,7 +111,9 @@ exports[`AST Fixtures legacy-fixtures expressions call-expression-type-arguments arguments: Array [], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [83, 86], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/1-TSESTree-AST.shot index b65621e0c46..e1967102708 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [79, 80], loc: { @@ -24,7 +27,9 @@ Program { arguments: Array [], callee: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [87, 88], loc: { @@ -39,7 +44,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [89, 90], loc: { @@ -69,7 +76,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [89, 90], loc: { @@ -107,6 +116,7 @@ Program { }, }, ], + declare: false, kind: "const", range: [73, 94], diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot index 47fd19df7a9..ec536369f88 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/new-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures expressions new-expression-type-arguments declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [79, 80], loc: { @@ -28,14 +31,16 @@ exports[`AST Fixtures legacy-fixtures expressions new-expression-type-arguments arguments: Array [], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [87, 88], loc: { start: { column: 14, line: 3 }, end: { column: 15, line: 3 }, - }, - }, +- }, +- }, - typeArguments: TSTypeParameterInstantiation { - type: 'TSTypeParameterInstantiation', - params: Array [ @@ -43,7 +48,9 @@ exports[`AST Fixtures legacy-fixtures expressions new-expression-type-arguments - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'B', +- optional: false, - - range: [89, 90], - loc: { @@ -64,8 +71,8 @@ exports[`AST Fixtures legacy-fixtures expressions new-expression-type-arguments - loc: { - start: { column: 15, line: 3 }, - end: { column: 18, line: 3 }, -- }, -- }, + }, + }, typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ @@ -73,7 +80,9 @@ exports[`AST Fixtures legacy-fixtures expressions new-expression-type-arguments type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [89, 90], loc: { @@ -111,6 +120,7 @@ exports[`AST Fixtures legacy-fixtures expressions new-expression-type-arguments }, }, ], +- declare: false, kind: 'const', range: [73, 94], diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/1-TSESTree-AST.shot index 67168f76a86..ed1558dd1df 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/1-TSESTree-AST.shot @@ -16,7 +16,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [73, 76], loc: { @@ -27,7 +29,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [78, 81], loc: { @@ -50,7 +54,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [82, 83], loc: { @@ -80,7 +86,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [82, 83], loc: { @@ -136,7 +144,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [88, 91], loc: { @@ -147,7 +157,9 @@ Program { optional: true, property: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [93, 96], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot index 562cb823f8f..79b391cda5d 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot @@ -20,7 +20,9 @@ exports[`AST Fixtures legacy-fixtures expressions optional-call-expression-type- computed: false, object: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [73, 76], loc: { @@ -31,7 +33,9 @@ exports[`AST Fixtures legacy-fixtures expressions optional-call-expression-type- optional: true, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [78, 81], loc: { @@ -54,7 +58,9 @@ exports[`AST Fixtures legacy-fixtures expressions optional-call-expression-type- - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'A', +- optional: false, - - range: [82, 83], - loc: { @@ -84,7 +90,9 @@ exports[`AST Fixtures legacy-fixtures expressions optional-call-expression-type- type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [82, 83], loc: { @@ -140,7 +148,9 @@ exports[`AST Fixtures legacy-fixtures expressions optional-call-expression-type- computed: false, object: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [88, 91], loc: { @@ -151,7 +161,9 @@ exports[`AST Fixtures legacy-fixtures expressions optional-call-expression-type- optional: true, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [93, 96], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/1-TSESTree-AST.shot index 737bf26abde..e03d8af9d50 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/1-TSESTree-AST.shot @@ -36,7 +36,9 @@ Program { }, tag: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [73, 76], loc: { @@ -51,7 +53,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [77, 80], loc: { @@ -81,7 +85,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [77, 80], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot index b36c5b7cb86..61e0f9e950f 100644 --- a/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/expressions/fixtures/tagged-template-expression-type-arguments/snapshots/5-AST-Alignment-AST.shot @@ -40,14 +40,16 @@ exports[`AST Fixtures legacy-fixtures expressions tagged-template-expression-typ }, tag: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [73, 76], loc: { start: { column: 0, line: 3 }, end: { column: 3, line: 3 }, - }, - }, +- }, +- }, - typeArguments: TSTypeParameterInstantiation { - type: 'TSTypeParameterInstantiation', - params: Array [ @@ -55,7 +57,9 @@ exports[`AST Fixtures legacy-fixtures expressions tagged-template-expression-typ - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'bar', +- optional: false, - - range: [77, 80], - loc: { @@ -76,8 +80,8 @@ exports[`AST Fixtures legacy-fixtures expressions tagged-template-expression-typ - loc: { - start: { column: 3, line: 3 }, - end: { column: 8, line: 3 }, -- }, -- }, + }, + }, typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ @@ -85,7 +89,9 @@ exports[`AST Fixtures legacy-fixtures expressions tagged-template-expression-typ type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [77, 80], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot index f4e1f8a04ed..e5eebf47f51 100644 --- a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -32,7 +33,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: Array [], name: "onlyRead", + optional: false, range: [86, 94], loc: { @@ -58,7 +61,9 @@ Program { ], key: Identifier { type: "Identifier", + decorators: Array [], name: "instanceMethod", + optional: false, range: [104, 118], loc: { @@ -67,6 +72,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -82,6 +88,7 @@ Program { end: { column: 21, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -108,9 +115,13 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [79, 80], loc: { @@ -118,6 +129,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 125], diff --git a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot index a4c8ddcb124..af49176862a 100644 --- a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -36,7 +37,9 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'onlyRead', +- optional: false, range: [86, 94], loc: { @@ -62,7 +65,9 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory ], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'instanceMethod', +- optional: false, range: [104, 118], loc: { @@ -71,6 +76,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -86,6 +92,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory end: { column: 21, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -112,9 +119,13 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory end: { column: 1, line: 6 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [79, 80], loc: { @@ -122,6 +133,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 125], diff --git a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot index cb404acaf12..31ed047366e 100644 --- a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -32,7 +33,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [86, 89], loc: { @@ -58,7 +61,9 @@ Program { ], key: Identifier { type: "Identifier", + decorators: Array [], name: "staticMethod", + optional: false, range: [106, 118], loc: { @@ -67,6 +72,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: true, value: FunctionExpression { @@ -82,6 +88,7 @@ Program { end: { column: 26, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -108,9 +115,13 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "C", + optional: false, range: [79, 80], loc: { @@ -118,6 +129,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 125], diff --git a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot index 1e97f5d5c08..e4b0d9dadc8 100644 --- a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -36,7 +37,9 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [86, 89], loc: { @@ -62,7 +65,9 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory ], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'staticMethod', +- optional: false, range: [106, 118], loc: { @@ -71,6 +76,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory }, }, kind: 'method', +- optional: false, - override: false, static: true, value: FunctionExpression { @@ -86,6 +92,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory end: { column: 26, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -112,9 +119,13 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory end: { column: 1, line: 6 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [79, 80], loc: { @@ -122,6 +133,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-factory end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 125], diff --git a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-instance-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-instance-member/snapshots/1-TSESTree-AST.shot index 68f9a1e928f..7bb1ca803a1 100644 --- a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-instance-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-instance-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -17,7 +18,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: Array [], name: "onlyRead", + optional: false, range: [86, 94], loc: { @@ -35,7 +38,9 @@ Program { ], key: Identifier { type: "Identifier", + decorators: Array [], name: "instanceMethod", + optional: false, range: [97, 111], loc: { @@ -44,6 +49,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -59,6 +65,7 @@ Program { end: { column: 21, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -85,9 +92,13 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [79, 80], loc: { @@ -95,6 +106,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot index fa544c6a3e8..9638d96862e 100644 --- a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-instanc body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -21,7 +22,9 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-instanc type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'onlyRead', +- optional: false, range: [86, 94], loc: { @@ -39,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-instanc ], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'instanceMethod', +- optional: false, range: [97, 111], loc: { @@ -48,6 +53,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-instanc }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -63,6 +69,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-instanc end: { column: 21, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -89,9 +96,13 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-instanc end: { column: 1, line: 6 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [79, 80], loc: { @@ -99,6 +110,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-instanc end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-static-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-static-member/snapshots/1-TSESTree-AST.shot index 50f63095d10..8a4d80af9d5 100644 --- a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-static-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-static-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -17,7 +18,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [86, 89], loc: { @@ -35,7 +38,9 @@ Program { ], key: Identifier { type: "Identifier", + decorators: Array [], name: "staticMethod", + optional: false, range: [99, 111], loc: { @@ -44,6 +49,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: true, value: FunctionExpression { @@ -59,6 +65,7 @@ Program { end: { column: 26, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -85,9 +92,13 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "D", + optional: false, range: [79, 80], loc: { @@ -95,6 +106,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-static-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-static-member/snapshots/5-AST-Alignment-AST.shot index 4b4f60f3ffa..27639e3a67b 100644 --- a/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-static-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/method-decorators/fixtures/method-decorator-static-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-static- body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -21,7 +22,9 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-static- type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [86, 89], loc: { @@ -39,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-static- ], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'staticMethod', +- optional: false, range: [99, 111], loc: { @@ -48,6 +53,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-static- }, }, kind: 'method', +- optional: false, - override: false, static: true, value: FunctionExpression { @@ -63,6 +69,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-static- end: { column: 26, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -89,9 +96,13 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-static- end: { column: 1, line: 6 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'D', +- optional: false, range: [79, 80], loc: { @@ -99,6 +110,7 @@ exports[`AST Fixtures legacy-fixtures method-decorators method-decorator-static- end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/ambient-module-declaration-with-import/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/ambient-module-declaration-with-import/snapshots/1-TSESTree-AST.shot index 3cdbc8537ae..288232cf7eb 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/ambient-module-declaration-with-import/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/ambient-module-declaration-with-import/snapshots/1-TSESTree-AST.shot @@ -29,7 +29,9 @@ Program { type: "ImportDefaultSpecifier", local: Identifier { type: "Identifier", + decorators: Array [], name: "fs", + optional: false, range: [114, 116], loc: { @@ -61,6 +63,7 @@ Program { }, }, declare: true, + global: false, id: Literal { type: "Literal", raw: "'i-use-things'", diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/ambient-module-declaration-with-import/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/ambient-module-declaration-with-import/snapshots/5-AST-Alignment-AST.shot index a6aff688ab8..afb7c5ca75c 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/ambient-module-declaration-with-import/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/ambient-module-declaration-with-import/snapshots/5-AST-Alignment-AST.shot @@ -33,7 +33,9 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules ambient-module-decl type: 'ImportDefaultSpecifier', local: Identifier { type: 'Identifier', +- decorators: Array [], name: 'fs', +- optional: false, range: [114, 116], loc: { @@ -65,6 +67,7 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules ambient-module-decl }, }, declare: true, +- global: false, id: Literal { type: 'Literal', raw: '\\\\'i-use-things\\\\'', diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/1-TSESTree-AST.shot index eaf0d5dcc37..360bd72369f 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/1-TSESTree-AST.shot @@ -15,11 +15,14 @@ Program { declaration: TSDeclareFunction { type: "TSDeclareFunction", async: false, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "select", + optional: false, range: [114, 120], loc: { @@ -30,7 +33,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "selector", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -83,7 +88,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Selection", + optional: false, range: [140, 149], loc: { @@ -151,9 +158,12 @@ Program { }, }, declare: true, + global: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "d3", + optional: false, range: [91, 93], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/5-AST-Alignment-AST.shot index 0e9179ec241..39ad0f238b4 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/declare-namespace-with-exported-function/snapshots/5-AST-Alignment-AST.shot @@ -19,11 +19,14 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules declare-namespace-w declaration: TSDeclareFunction { type: 'TSDeclareFunction', async: false, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'select', +- optional: false, range: [114, 120], loc: { @@ -34,7 +37,9 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules declare-namespace-w params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'selector', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -87,7 +92,9 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules declare-namespace-w - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Selection', +- optional: false, range: [140, 149], loc: { @@ -155,9 +162,12 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules declare-namespace-w }, }, declare: true, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'd3', +- optional: false, range: [91, 93], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/1-TSESTree-AST.shot index 8177f6c6582..11a277b1919 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/1-TSESTree-AST.shot @@ -22,9 +22,12 @@ Program { }, }, declare: true, + global: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "global", + optional: false, range: [107, 113], loc: { @@ -53,9 +56,12 @@ Program { }, }, declare: true, + global: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "global", + optional: false, range: [137, 143], loc: { @@ -83,7 +89,9 @@ Program { global: true, id: Identifier { type: "Identifier", + decorators: Array [], name: "global", + optional: false, range: [81, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/5-AST-Alignment-AST.shot index 3256de74436..369d392b0bb 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/global-module-declaration/snapshots/5-AST-Alignment-AST.shot @@ -26,9 +26,12 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules global-module-decla }, }, declare: true, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'global', +- optional: false, range: [107, 113], loc: { @@ -57,9 +60,12 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules global-module-decla }, }, declare: true, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'global', +- optional: false, range: [137, 143], loc: { @@ -87,7 +93,9 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules global-module-decla global: true, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'global', +- optional: false, range: [81, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/module-with-default-exports/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/module-with-default-exports/snapshots/1-TSESTree-AST.shot index 8ad7040deee..c058108d7f6 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/module-with-default-exports/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/module-with-default-exports/snapshots/1-TSESTree-AST.shot @@ -13,15 +13,19 @@ Program { type: "ExportDefaultDeclaration", declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "method", + optional: false, range: [119, 125], loc: { @@ -30,6 +34,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -45,6 +50,7 @@ Program { end: { column: 18, line: 5 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -55,7 +61,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "C", + optional: false, range: [129, 130], loc: { @@ -99,9 +107,13 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "C", + optional: false, range: [111, 112], loc: { @@ -109,6 +121,7 @@ Program { end: { column: 24, line: 4 }, }, }, + implements: Array [], superClass: null, range: [105, 137], @@ -140,11 +153,14 @@ Program { end: { column: 34, line: 7 }, }, }, + declare: false, expression: false, generator: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [164, 167], loc: { @@ -176,6 +192,8 @@ Program { end: { column: 1, line: 8 }, }, }, + declare: false, + global: false, id: Literal { type: "Literal", raw: "'foo'", diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/module-with-default-exports/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/module-with-default-exports/snapshots/5-AST-Alignment-AST.shot index 934dda17d28..841cb7e30d9 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/module-with-default-exports/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/module-with-default-exports/snapshots/5-AST-Alignment-AST.shot @@ -17,15 +17,19 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules module-with-default type: 'ExportDefaultDeclaration', declaration: ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'method', +- optional: false, range: [119, 125], loc: { @@ -34,6 +38,7 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules module-with-default }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -49,6 +54,7 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules module-with-default end: { column: 18, line: 5 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -59,7 +65,9 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules module-with-default type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [129, 130], loc: { @@ -103,9 +111,13 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules module-with-default end: { column: 3, line: 6 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [111, 112], loc: { @@ -113,6 +125,7 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules module-with-default end: { column: 24, line: 4 }, }, }, +- implements: Array [], superClass: null, range: [105, 137], @@ -144,11 +157,14 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules module-with-default end: { column: 34, line: 7 }, }, }, +- declare: false, expression: false, generator: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [164, 167], loc: { @@ -180,6 +196,8 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules module-with-default end: { column: 1, line: 8 }, }, }, +- declare: false, +- global: false, id: Literal { type: 'Literal', raw: '\\\\'foo\\\\'', diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/1-TSESTree-AST.shot index e88155e9351..35e94cd983c 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/1-TSESTree-AST.shot @@ -17,9 +17,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [97, 98], loc: { @@ -46,6 +49,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [93, 115], @@ -69,15 +73,19 @@ Program { assertions: Array [], declaration: ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "constructor", + optional: false, range: [143, 154], loc: { @@ -86,6 +94,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -101,6 +110,7 @@ Program { end: { column: 54, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -108,9 +118,13 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "public", + decorators: Array [], + override: false, parameter: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -136,6 +150,8 @@ Program { end: { column: 32, line: 6 }, }, }, + readonly: false, + static: false, range: [155, 171], loc: { @@ -146,9 +162,13 @@ Program { TSParameterProperty { type: "TSParameterProperty", accessibility: "public", + decorators: Array [], + override: false, parameter: Identifier { type: "Identifier", + decorators: Array [], name: "y", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -174,6 +194,8 @@ Program { end: { column: 50, line: 6 }, }, }, + readonly: false, + static: false, range: [173, 189], loc: { @@ -204,9 +226,13 @@ Program { end: { column: 3, line: 7 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Point", + optional: false, range: [131, 136], loc: { @@ -214,6 +240,7 @@ Program { end: { column: 20, line: 5 }, }, }, + implements: Array [], superClass: null, range: [125, 197], @@ -253,7 +280,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "name", + optional: false, range: [250, 254], loc: { @@ -261,6 +290,9 @@ Program { end: { column: 10, line: 10 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -294,9 +326,13 @@ Program { end: { column: 5, line: 11 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Id", + optional: false, range: [239, 241], loc: { @@ -329,9 +365,13 @@ Program { end: { column: 3, line: 12 }, }, }, + declare: false, + global: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [214, 215], loc: { @@ -365,9 +405,13 @@ Program { end: { column: 1, line: 13 }, }, }, + declare: false, + global: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [80, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/5-AST-Alignment-AST.shot index 1b64e4bd8e8..7f92c85dbc5 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/nested-internal-module/snapshots/5-AST-Alignment-AST.shot @@ -21,9 +21,12 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, range: [97, 98], loc: { @@ -50,6 +53,7 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod }, }, ], +- declare: false, kind: 'var', range: [93, 115], @@ -73,15 +77,19 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod assertions: Array [], declaration: ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [143, 154], loc: { @@ -90,6 +98,7 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -105,6 +114,7 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod end: { column: 54, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -112,9 +122,13 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod TSParameterProperty { type: 'TSParameterProperty', accessibility: 'public', +- decorators: Array [], +- override: false, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -140,6 +154,8 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod end: { column: 32, line: 6 }, }, }, +- readonly: false, +- static: false, range: [155, 171], loc: { @@ -150,9 +166,13 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod TSParameterProperty { type: 'TSParameterProperty', accessibility: 'public', +- decorators: Array [], +- override: false, parameter: Identifier { type: 'Identifier', +- decorators: Array [], name: 'y', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -178,6 +198,8 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod end: { column: 50, line: 6 }, }, }, +- readonly: false, +- static: false, range: [173, 189], loc: { @@ -208,9 +230,13 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod end: { column: 3, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Point', +- optional: false, range: [131, 136], loc: { @@ -218,6 +244,7 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod end: { column: 20, line: 5 }, }, }, +- implements: Array [], superClass: null, range: [125, 197], @@ -257,7 +284,9 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'name', +- optional: false, range: [250, 254], loc: { @@ -265,6 +294,9 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod end: { column: 10, line: 10 }, }, }, +- optional: false, +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -298,9 +330,13 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod end: { column: 5, line: 11 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Id', +- optional: false, range: [239, 241], loc: { @@ -333,9 +369,13 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod end: { column: 3, line: 12 }, }, }, +- declare: false, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [214, 215], loc: { @@ -369,9 +409,13 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules nested-internal-mod end: { column: 1, line: 13 }, }, }, +- declare: false, +- global: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [80, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/shorthand-ambient-module-declaration/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/shorthand-ambient-module-declaration/snapshots/1-TSESTree-AST.shot index 7f7359ae7fa..58f91b5012a 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/shorthand-ambient-module-declaration/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/shorthand-ambient-module-declaration/snapshots/1-TSESTree-AST.shot @@ -7,6 +7,7 @@ Program { TSModuleDeclaration { type: "TSModuleDeclaration", declare: true, + global: false, id: Literal { type: "Literal", raw: "'hot-new-module'", diff --git a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/shorthand-ambient-module-declaration/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/shorthand-ambient-module-declaration/snapshots/5-AST-Alignment-AST.shot index 99c15addea3..75fcf56c048 100644 --- a/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/shorthand-ambient-module-declaration/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/namespaces-and-modules/fixtures/shorthand-ambient-module-declaration/snapshots/5-AST-Alignment-AST.shot @@ -11,6 +11,7 @@ exports[`AST Fixtures legacy-fixtures namespaces-and-modules shorthand-ambient-m TSModuleDeclaration { type: 'TSModuleDeclaration', declare: true, +- global: false, id: Literal { type: 'Literal', raw: '\\\\'hot-new-module\\\\'', diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-constructor/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-constructor/snapshots/1-TSESTree-AST.shot index afe6694b9f5..4cfe1a672ab 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-constructor/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-constructor/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "constructor", + optional: false, range: [91, 102], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "constructor", + optional: false, override: false, static: false, value: FunctionExpression { @@ -50,7 +55,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "title", + optional: false, range: [153, 158], loc: { @@ -71,7 +78,9 @@ Program { computed: false, object: Identifier { type: "Identifier", + decorators: Array [], name: "config", + optional: false, range: [161, 167], loc: { @@ -82,7 +91,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "title", + optional: false, range: [168, 173], loc: { @@ -119,6 +130,7 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -133,7 +145,9 @@ Program { arguments: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "APP_CONFIG", + optional: false, range: [111, 121], loc: { @@ -144,7 +158,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: Array [], name: "Inject", + optional: false, range: [104, 110], loc: { @@ -169,13 +185,16 @@ Program { }, ], name: "config", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "AppConfig", + optional: false, range: [131, 140], loc: { @@ -227,9 +246,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Service", + optional: false, range: [79, 86], loc: { @@ -237,6 +260,7 @@ Program { end: { column: 13, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 180], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-constructor/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-constructor/snapshots/5-AST-Alignment-AST.shot index 888328c7c4b..e7f1056280c 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-constructor/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-constructor/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'constructor', +- optional: false, range: [91, 102], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c }, }, kind: 'constructor', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -54,7 +59,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'title', +- optional: false, range: [153, 158], loc: { @@ -75,7 +82,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c computed: false, object: Identifier { type: 'Identifier', +- decorators: Array [], name: 'config', +- optional: false, range: [161, 167], loc: { @@ -86,7 +95,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'title', +- optional: false, range: [168, 173], loc: { @@ -123,6 +134,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c end: { column: 3, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -137,7 +149,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c arguments: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'APP_CONFIG', +- optional: false, range: [111, 121], loc: { @@ -148,7 +162,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Inject', +- optional: false, range: [104, 110], loc: { @@ -173,13 +189,16 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c }, ], name: 'config', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'AppConfig', +- optional: false, range: [131, 140], loc: { @@ -231,9 +250,13 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Service', +- optional: false, range: [79, 86], loc: { @@ -241,6 +264,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-c end: { column: 13, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 180], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-instance-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-instance-member/snapshots/1-TSESTree-AST.shot index ab2868fbe2d..79e51f0dbd6 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-instance-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-instance-member/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [87, 90], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 36, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -64,7 +70,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: Array [], name: "special", + optional: false, range: [92, 99], loc: { @@ -89,6 +97,7 @@ Program { }, ], name: "baz", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -137,9 +146,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -147,6 +160,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 123], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot index 5f239612d63..c38dc753a9d 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [87, 90], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d end: { column: 36, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -68,7 +74,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'special', +- optional: false, range: [92, 99], loc: { @@ -93,6 +101,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d }, ], name: 'baz', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -141,9 +150,13 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -151,6 +164,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 123], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-static-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-static-member/snapshots/1-TSESTree-AST.shot index 48bbd6bdb66..d6b09370c9b 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-static-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-static-member/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [100, 103], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: true, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 43, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -64,7 +70,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: Array [], name: "special", + optional: false, range: [105, 112], loc: { @@ -89,6 +97,7 @@ Program { }, ], name: "baz", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -137,9 +146,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "StaticFoo", + optional: false, range: [79, 88], loc: { @@ -147,6 +160,7 @@ Program { end: { column: 15, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 136], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-static-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-static-member/snapshots/5-AST-Alignment-AST.shot index ec48a91bda0..392950de414 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-static-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-decorator-static-member/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [100, 103], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d }, }, kind: 'method', +- optional: false, - override: false, static: true, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d end: { column: 43, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -68,7 +74,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'special', +- optional: false, range: [105, 112], loc: { @@ -93,6 +101,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d }, ], name: 'baz', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -141,9 +150,13 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'StaticFoo', +- optional: false, range: [79, 88], loc: { @@ -151,6 +164,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-d end: { column: 15, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 136], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-instance-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-instance-member/snapshots/1-TSESTree-AST.shot index dbb217b47aa..6394f66f9c8 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-instance-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-instance-member/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "greet", + optional: false, range: [91, 96], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -51,7 +56,9 @@ Program { operator: "+", right: Identifier { type: "Identifier", + decorators: Array [], name: "name", + optional: false, range: [145, 149], loc: { @@ -100,6 +107,7 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -111,7 +119,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: Array [], name: "required", + optional: false, range: [98, 106], loc: { @@ -128,6 +138,7 @@ Program { }, ], name: "name", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -176,9 +187,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Greeter", + optional: false, range: [79, 86], loc: { @@ -186,6 +201,7 @@ Program { end: { column: 13, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 162], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot index 8ea69118b84..99c3f2b102d 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-i body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'greet', +- optional: false, range: [91, 96], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-i }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -55,7 +60,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-i operator: '+', right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'name', +- optional: false, range: [145, 149], loc: { @@ -104,6 +111,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-i end: { column: 3, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -115,7 +123,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-i type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'required', +- optional: false, range: [98, 106], loc: { @@ -132,6 +142,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-i }, ], name: 'name', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -180,9 +191,13 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-i end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Greeter', +- optional: false, range: [79, 86], loc: { @@ -190,6 +205,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-i end: { column: 13, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 162], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-static-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-static-member/snapshots/1-TSESTree-AST.shot index d4cdbef76e3..0ec5d681026 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-static-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-static-member/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "greet", + optional: false, range: [104, 109], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: true, value: FunctionExpression { @@ -51,7 +56,9 @@ Program { operator: "+", right: Identifier { type: "Identifier", + decorators: Array [], name: "name", + optional: false, range: [158, 162], loc: { @@ -100,6 +107,7 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -111,7 +119,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: Array [], name: "required", + optional: false, range: [111, 119], loc: { @@ -128,6 +138,7 @@ Program { }, ], name: "name", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -176,9 +187,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "StaticGreeter", + optional: false, range: [79, 92], loc: { @@ -186,6 +201,7 @@ Program { end: { column: 19, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 175], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-static-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-static-member/snapshots/5-AST-Alignment-AST.shot index ba29c4e732b..51801b27f09 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-static-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-decorator-static-member/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-s body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'greet', +- optional: false, range: [104, 109], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-s }, }, kind: 'method', +- optional: false, - override: false, static: true, value: FunctionExpression { @@ -55,7 +60,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-s operator: '+', right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'name', +- optional: false, range: [158, 162], loc: { @@ -104,6 +111,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-s end: { column: 3, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -115,7 +123,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-s type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'required', +- optional: false, range: [111, 119], loc: { @@ -132,6 +142,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-s }, ], name: 'name', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSStringKeyword { @@ -180,9 +191,13 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-s end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'StaticGreeter', +- optional: false, range: [79, 92], loc: { @@ -190,6 +205,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-decorator-s end: { column: 19, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 175], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-object-pattern-decorator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-object-pattern-decorator/snapshots/1-TSESTree-AST.shot index c99dd3f4cbe..8a4f564bdc8 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-object-pattern-decorator/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-object-pattern-decorator/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [87, 90], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -38,6 +43,7 @@ Program { end: { column: 37, line: 4 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -64,7 +70,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: Array [], name: "special", + optional: false, range: [92, 99], loc: { @@ -88,13 +96,16 @@ Program { }, }, ], + optional: false, properties: Array [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [108, 111], loc: { @@ -104,10 +115,13 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: true, value: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [108, 111], loc: { @@ -171,9 +185,13 @@ Program { end: { column: 1, line: 5 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [79, 82], loc: { @@ -181,6 +199,7 @@ Program { end: { column: 9, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 124], diff --git a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-object-pattern-decorator/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-object-pattern-decorator/snapshots/5-AST-Alignment-AST.shot index 95cc2b08579..514ba574c58 100644 --- a/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-object-pattern-decorator/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/parameter-decorators/fixtures/parameter-object-pattern-decorator/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-object-patt body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [87, 90], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-object-patt }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -42,6 +47,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-object-patt end: { column: 37, line: 4 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -68,7 +74,9 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-object-patt ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'special', +- optional: false, range: [92, 99], loc: { @@ -92,13 +100,16 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-object-patt }, }, ], +- optional: false, properties: Array [ Property { type: 'Property', computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [108, 111], loc: { @@ -108,10 +119,13 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-object-patt }, kind: 'init', method: false, +- optional: false, shorthand: true, value: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [108, 111], loc: { @@ -175,9 +189,13 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-object-patt end: { column: 1, line: 5 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [79, 82], loc: { @@ -185,6 +203,7 @@ exports[`AST Fixtures legacy-fixtures parameter-decorators parameter-object-patt end: { column: 9, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 124], diff --git a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot index ab8352e9521..9971c9ab902 100644 --- a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-instance-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -21,7 +22,9 @@ Program { arguments: Array [], callee: Identifier { type: "Identifier", + decorators: Array [], name: "Input", + optional: false, range: [98, 103], loc: { @@ -45,9 +48,12 @@ Program { }, }, ], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "data", + optional: false, range: [106, 110], loc: { @@ -55,7 +61,9 @@ Program { end: { column: 15, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: null, @@ -77,7 +85,9 @@ Program { arguments: Array [], callee: Identifier { type: "Identifier", + decorators: Array [], name: "Output", + optional: false, range: [115, 121], loc: { @@ -101,9 +111,12 @@ Program { }, }, ], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "click", + optional: false, range: [126, 131], loc: { @@ -111,14 +124,18 @@ Program { end: { column: 7, line: 6 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: NewExpression { type: "NewExpression", arguments: Array [], callee: Identifier { type: "Identifier", + decorators: Array [], name: "EventEmitter", + optional: false, range: [138, 150], loc: { @@ -148,9 +165,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "SomeComponent", + optional: false, range: [79, 92], loc: { @@ -158,6 +179,7 @@ Program { end: { column: 19, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 155], diff --git a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot index 2190670be4d..30900af22c0 100644 --- a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-instance-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -25,7 +26,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac arguments: Array [], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Input', +- optional: false, range: [98, 103], loc: { @@ -49,9 +52,12 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac }, }, ], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'data', +- optional: false, range: [106, 110], loc: { @@ -59,7 +65,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac end: { column: 15, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: null, @@ -81,7 +89,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac arguments: Array [], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Output', +- optional: false, range: [115, 121], loc: { @@ -105,9 +115,12 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac }, }, ], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'click', +- optional: false, range: [126, 131], loc: { @@ -115,14 +128,18 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac end: { column: 7, line: 6 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: NewExpression { type: 'NewExpression', arguments: Array [], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'EventEmitter', +- optional: false, range: [138, 150], loc: { @@ -152,9 +169,13 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'SomeComponent', +- optional: false, range: [79, 92], loc: { @@ -162,6 +183,7 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac end: { column: 19, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 155], diff --git a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot index 8f8fb3fb6c4..ff702c884f4 100644 --- a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-static-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -33,7 +34,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: Array [], name: "configurable", + optional: false, range: [86, 98], loc: { @@ -57,9 +60,12 @@ Program { }, }, ], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop1", + optional: false, range: [112, 117], loc: { @@ -67,7 +73,9 @@ Program { end: { column: 34, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: true, value: null, @@ -101,7 +109,9 @@ Program { ], callee: Identifier { type: "Identifier", + decorators: Array [], name: "configurable", + optional: false, range: [123, 135], loc: { @@ -125,9 +135,12 @@ Program { }, }, ], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "prop2", + optional: false, range: [152, 157], loc: { @@ -135,7 +148,9 @@ Program { end: { column: 14, line: 7 }, }, }, + optional: false, override: false, + readonly: false, static: true, value: null, @@ -153,9 +168,13 @@ Program { end: { column: 1, line: 8 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [79, 80], loc: { @@ -163,6 +182,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 160], diff --git a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot index 600f2728bab..837f9a425a7 100644 --- a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-factory-static-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -37,7 +38,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'configurable', +- optional: false, range: [86, 98], loc: { @@ -61,9 +64,12 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac }, }, ], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop1', +- optional: false, range: [112, 117], loc: { @@ -71,7 +77,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac end: { column: 34, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: true, value: null, @@ -105,7 +113,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac ], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'configurable', +- optional: false, range: [123, 135], loc: { @@ -129,9 +139,12 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac }, }, ], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'prop2', +- optional: false, range: [152, 157], loc: { @@ -139,7 +152,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac end: { column: 14, line: 7 }, }, }, +- optional: false, - override: false, +- readonly: false, static: true, value: null, @@ -157,9 +172,13 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac end: { column: 1, line: 8 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [79, 80], loc: { @@ -167,6 +186,7 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-fac end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 160], diff --git a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-instance-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-instance-member/snapshots/1-TSESTree-AST.shot index 8c553fa54dc..02103318ad6 100644 --- a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-instance-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-instance-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -18,7 +19,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [86, 89], loc: { @@ -34,9 +37,12 @@ Program { }, }, ], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [90, 91], loc: { @@ -44,7 +50,9 @@ Program { end: { column: 8, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: null, @@ -63,7 +71,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: Array [], name: "bar", + optional: false, range: [96, 99], loc: { @@ -79,9 +89,12 @@ Program { }, }, ], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "y", + optional: false, range: [102, 103], loc: { @@ -89,7 +102,9 @@ Program { end: { column: 3, line: 6 }, }, }, + optional: false, override: false, + readonly: false, static: false, value: null, @@ -107,9 +122,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "B", + optional: false, range: [79, 80], loc: { @@ -117,6 +136,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 106], diff --git a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot index 01d21db7aba..bfed32cce86 100644 --- a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-instance-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-ins body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -22,7 +23,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-ins type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [86, 89], loc: { @@ -38,9 +41,12 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-ins }, }, ], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, range: [90, 91], loc: { @@ -48,7 +54,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-ins end: { column: 8, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: null, @@ -67,7 +75,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-ins type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'bar', +- optional: false, range: [96, 99], loc: { @@ -83,9 +93,12 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-ins }, }, ], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'y', +- optional: false, range: [102, 103], loc: { @@ -93,7 +106,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-ins end: { column: 3, line: 6 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, value: null, @@ -111,9 +126,13 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-ins end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'B', +- optional: false, range: [79, 80], loc: { @@ -121,6 +140,7 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-ins end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 106], diff --git a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-static-member/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-static-member/snapshots/1-TSESTree-AST.shot index 747ae05d1e8..c538ac16b9c 100644 --- a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-static-member/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-static-member/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -18,7 +19,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: Array [], name: "baz", + optional: false, range: [86, 89], loc: { @@ -34,9 +37,12 @@ Program { }, }, ], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [97, 98], loc: { @@ -44,7 +50,9 @@ Program { end: { column: 15, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: true, value: null, @@ -63,7 +71,9 @@ Program { type: "Decorator", expression: Identifier { type: "Identifier", + decorators: Array [], name: "qux", + optional: false, range: [103, 106], loc: { @@ -79,9 +89,12 @@ Program { }, }, ], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [116, 117], loc: { @@ -89,7 +102,9 @@ Program { end: { column: 10, line: 6 }, }, }, + optional: false, override: false, + readonly: false, static: true, value: null, @@ -107,9 +122,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "C", + optional: false, range: [79, 80], loc: { @@ -117,6 +136,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 120], diff --git a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-static-member/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-static-member/snapshots/5-AST-Alignment-AST.shot index 8e633925fae..13aebd9d608 100644 --- a/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-static-member/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/property-decorators/fixtures/property-decorator-static-member/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-sta body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -22,7 +23,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-sta type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'baz', +- optional: false, range: [86, 89], loc: { @@ -38,9 +41,12 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-sta }, }, ], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [97, 98], loc: { @@ -48,7 +54,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-sta end: { column: 15, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: true, value: null, @@ -67,7 +75,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-sta type: 'Decorator', expression: Identifier { type: 'Identifier', +- decorators: Array [], name: 'qux', +- optional: false, range: [103, 106], loc: { @@ -83,9 +93,12 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-sta }, }, ], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [116, 117], loc: { @@ -93,7 +106,9 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-sta end: { column: 10, line: 6 }, }, }, +- optional: false, - override: false, +- readonly: false, static: true, value: null, @@ -111,9 +126,13 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-sta end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'C', +- optional: false, range: [79, 80], loc: { @@ -121,6 +140,7 @@ exports[`AST Fixtures legacy-fixtures property-decorators property-decorator-sta end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 120], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/array-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/array-type/snapshots/1-TSESTree-AST.shot index cc32cb09d97..fe2204da019 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/array-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/array-type/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/array-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/array-type/snapshots/5-AST-Alignment-AST.shot index 66962c9338c..d167672eac0 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/array-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/array-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,59 @@ exports[`AST Fixtures legacy-fixtures types array-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSArrayType { + type: 'TSArrayType', + elementType: TSStringKeyword { + type: 'TSStringKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [84, 92], + loc: { + start: { column: 11, line: 3 }, + end: { column: 19, line: 3 }, + }, + }, + + range: [73, 93], + loc: { + start: { column: 0, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 94], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/1-TSESTree-AST.shot index 9aeab0de28a..abbbdc6b6b1 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Unpacked", + optional: false, range: [78, 86], loc: { @@ -22,7 +25,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [92, 93], loc: { @@ -46,7 +51,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [109, 110], loc: { @@ -82,7 +89,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [124, 125], loc: { @@ -104,7 +113,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [140, 141], loc: { @@ -133,7 +144,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [152, 153], loc: { @@ -160,7 +173,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [176, 177], loc: { @@ -193,7 +208,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Promise", + optional: false, range: [162, 169], loc: { @@ -211,7 +228,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [176, 177], loc: { @@ -253,7 +272,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [189, 190], loc: { @@ -272,7 +293,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [183, 184], loc: { @@ -298,7 +321,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [146, 147], loc: { @@ -324,7 +349,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [118, 119], loc: { @@ -354,7 +381,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [87, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/5-AST-Alignment-AST.shot index d93041d6a5c..abe31fcdd96 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-nested/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Unpacked', +- optional: false, range: [78, 86], loc: { @@ -26,7 +29,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [92, 93], loc: { @@ -50,6 +55,7 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], + elementType: TSParenthesizedType { + type: 'TSParenthesizedType', + typeAnnotation: TSInferType { @@ -57,6 +63,7 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme + typeParameter: TSTypeParameter { + type: 'TSTypeParameter', name: 'U', +- optional: false, range: [109, 110], loc: { @@ -97,7 +104,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [124, 125], loc: { @@ -119,7 +128,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [140, 141], - loc: { @@ -149,7 +160,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [152, 153], loc: { @@ -176,7 +189,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [176, 177], - loc: { @@ -209,7 +224,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Promise', +- optional: false, range: [162, 169], loc: { @@ -227,7 +244,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [176, 177], - loc: { @@ -270,7 +289,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [189, 190], loc: { @@ -289,7 +310,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [183, 184], loc: { @@ -315,7 +338,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [146, 147], loc: { @@ -341,7 +366,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [118, 119], loc: { @@ -371,7 +398,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-nested AST Alignme - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [87, 88], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-simple/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-simple/snapshots/1-TSESTree-AST.shot index a8b7cf3db2f..f91e7caf5e2 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-simple/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-simple/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [78, 81], loc: { @@ -22,7 +25,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [87, 88], loc: { @@ -45,7 +50,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [99, 100], loc: { @@ -53,6 +60,9 @@ Program { end: { column: 27, line: 3 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSInferType { @@ -62,7 +72,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [108, 109], loc: { @@ -104,7 +116,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [111, 112], loc: { @@ -112,6 +126,9 @@ Program { end: { column: 39, line: 3 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSInferType { @@ -121,7 +138,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [120, 121], loc: { @@ -179,7 +198,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [126, 127], loc: { @@ -209,7 +230,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [82, 83], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-simple/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-simple/snapshots/5-AST-Alignment-AST.shot index a4c653aa539..af4f8861112 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-simple/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-simple/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [78, 81], loc: { @@ -26,7 +29,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [87, 88], loc: { @@ -49,7 +54,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [99, 100], loc: { @@ -57,6 +64,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme end: { column: 27, line: 3 }, }, }, +- optional: false, +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSInferType { @@ -66,7 +76,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [108, 109], - loc: { @@ -109,7 +121,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', +- optional: false, range: [111, 112], loc: { @@ -117,6 +131,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme end: { column: 39, line: 3 }, }, }, +- optional: false, +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSInferType { @@ -126,8 +143,11 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', -- +- optional: false, ++ name: 'U', + - range: [120, 121], - loc: { - start: { column: 47, line: 3 }, @@ -135,8 +155,7 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme - }, - }, - out: false, -+ name: 'U', - +- range: [120, 121], loc: { start: { column: 47, line: 3 }, @@ -185,7 +204,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [126, 127], loc: { @@ -215,7 +236,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-simple AST Alignme - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [82, 83], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/1-TSESTree-AST.shot index 50862b4fa3e..dfc83c045ad 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "X3", + optional: false, range: [78, 80], loc: { @@ -22,7 +25,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [86, 87], loc: { @@ -56,7 +61,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [103, 104], loc: { @@ -105,7 +112,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [136, 137], loc: { @@ -130,7 +139,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "MustBeNumber", + optional: false, range: [123, 135], loc: { @@ -145,7 +156,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [136, 137], loc: { @@ -190,7 +203,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [81, 82], loc: { @@ -223,9 +238,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "X4", + optional: false, range: [153, 155], loc: { @@ -239,7 +257,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [161, 162], loc: { @@ -273,7 +293,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [178, 179], loc: { @@ -312,7 +334,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [202, 203], loc: { @@ -361,7 +385,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [237, 238], loc: { @@ -386,7 +412,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "MustBeNumber", + optional: false, range: [224, 236], loc: { @@ -401,7 +429,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [237, 238], loc: { @@ -446,7 +476,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [156, 157], loc: { @@ -479,9 +511,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "X5", + optional: false, range: [256, 258], loc: { @@ -495,7 +530,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [264, 265], loc: { @@ -529,7 +566,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [281, 282], loc: { @@ -559,7 +598,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [305, 306], loc: { @@ -608,7 +649,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [325, 326], loc: { @@ -633,7 +676,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "MustBeNumber", + optional: false, range: [312, 324], loc: { @@ -648,7 +693,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [325, 326], loc: { @@ -693,7 +740,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [259, 260], loc: { @@ -726,9 +775,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "X6", + optional: false, range: [344, 346], loc: { @@ -742,7 +794,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [352, 353], loc: { @@ -767,7 +821,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [369, 370], loc: { @@ -806,7 +862,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [378, 379], loc: { @@ -855,7 +913,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [413, 414], loc: { @@ -880,7 +940,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "MustBeNumber", + optional: false, range: [400, 412], loc: { @@ -895,7 +957,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [413, 414], loc: { @@ -940,7 +1004,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [347, 348], loc: { @@ -973,9 +1039,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "X7", + optional: false, range: [432, 434], loc: { @@ -989,7 +1058,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [440, 441], loc: { @@ -1023,7 +1094,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [457, 458], loc: { @@ -1062,7 +1135,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [481, 482], loc: { @@ -1106,7 +1181,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [503, 504], loc: { @@ -1136,7 +1213,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [435, 436], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/5-AST-Alignment-AST.shot index b09be3c8f53..0d22bfebc50 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer-with-constraint/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X3', +- optional: false, range: [78, 80], loc: { @@ -26,7 +29,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [86, 87], loc: { @@ -60,7 +65,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [103, 104], - loc: { @@ -110,7 +117,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [136, 137], - loc: { @@ -135,7 +144,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'MustBeNumber', +- optional: false, range: [123, 135], loc: { @@ -150,7 +161,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [136, 137], loc: { @@ -195,7 +208,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [81, 82], - loc: { @@ -229,9 +244,12 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X4', +- optional: false, range: [153, 155], loc: { @@ -245,7 +263,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [161, 162], loc: { @@ -279,7 +299,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [178, 179], - loc: { @@ -319,8 +341,11 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', -- +- optional: false, ++ name: 'U', + - range: [202, 203], - loc: { - start: { column: 54, line: 4 }, @@ -328,8 +353,7 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - }, - }, - out: false, -+ name: 'U', - +- range: [202, 218], loc: { start: { column: 54, line: 4 }, @@ -369,7 +393,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [237, 238], - loc: { @@ -394,7 +420,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'MustBeNumber', +- optional: false, range: [224, 236], loc: { @@ -409,7 +437,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [237, 238], loc: { @@ -454,8 +484,11 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', -- +- optional: false, ++ name: 'T', + - range: [156, 157], - loc: { - start: { column: 8, line: 4 }, @@ -463,8 +496,7 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - }, - }, - out: false, -+ name: 'T', - +- range: [156, 157], loc: { start: { column: 8, line: 4 }, @@ -488,9 +520,12 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X5', +- optional: false, range: [256, 258], loc: { @@ -504,7 +539,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [264, 265], loc: { @@ -538,8 +575,11 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', -- +- optional: false, ++ name: 'U', + - range: [281, 282], - loc: { - start: { column: 30, line: 7 }, @@ -547,8 +587,7 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - }, - }, - out: false, -+ name: 'U', - +- range: [281, 297], loc: { start: { column: 30, line: 7 }, @@ -569,7 +608,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [305, 306], - loc: { @@ -619,7 +660,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [325, 326], - loc: { @@ -644,7 +687,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'MustBeNumber', +- optional: false, range: [312, 324], loc: { @@ -659,7 +704,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [325, 326], loc: { @@ -704,7 +751,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [259, 260], - loc: { @@ -738,9 +787,12 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X6', +- optional: false, range: [344, 346], loc: { @@ -754,7 +806,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [352, 353], loc: { @@ -779,8 +833,11 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', -- +- optional: false, ++ name: 'U', + - range: [369, 370], - loc: { - start: { column: 30, line: 10 }, @@ -788,8 +845,7 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - }, - }, - out: false, -+ name: 'U', - +- range: [369, 370], loc: { start: { column: 30, line: 10 }, @@ -819,7 +875,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [378, 379], - loc: { @@ -869,7 +927,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [413, 414], - loc: { @@ -894,7 +954,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'MustBeNumber', +- optional: false, range: [400, 412], loc: { @@ -909,7 +971,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [413, 414], loc: { @@ -954,7 +1018,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [347, 348], - loc: { @@ -988,9 +1054,12 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'X7', +- optional: false, range: [432, 434], loc: { @@ -1004,7 +1073,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [440, 441], loc: { @@ -1033,19 +1104,21 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS loc: { start: { column: 40, line: 13 }, end: { column: 46, line: 13 }, - }, - }, +- }, +- }, - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [457, 458], - loc: { - start: { column: 30, line: 13 }, - end: { column: 31, line: 13 }, -- }, -- }, + }, + }, - out: false, + name: 'U', @@ -1078,7 +1151,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [481, 482], - loc: { @@ -1123,7 +1198,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [503, 504], loc: { @@ -1153,7 +1230,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer-with-constraint AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [435, 436], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer/snapshots/1-TSESTree-AST.shot index 908466c31fd..a17fbc26873 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Element", + optional: false, range: [78, 85], loc: { @@ -22,7 +25,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [91, 92], loc: { @@ -46,7 +51,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [108, 109], loc: { @@ -80,7 +87,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [119, 120], loc: { @@ -99,7 +108,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [115, 116], loc: { @@ -129,7 +140,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [86, 87], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer/snapshots/5-AST-Alignment-AST.shot index 285e659b66b..f62fd05341b 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-infer/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer AST Alignment - AS body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Element', +- optional: false, range: [78, 85], loc: { @@ -26,7 +29,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer AST Alignment - AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [91, 92], loc: { @@ -50,6 +55,7 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer AST Alignment - AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], + elementType: TSParenthesizedType { + type: 'TSParenthesizedType', + typeAnnotation: TSInferType { @@ -57,6 +63,7 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer AST Alignment - AS + typeParameter: TSTypeParameter { + type: 'TSTypeParameter', name: 'U', +- optional: false, range: [108, 109], loc: { @@ -95,7 +102,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer AST Alignment - AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [119, 120], loc: { @@ -114,7 +123,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer AST Alignment - AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [115, 116], loc: { @@ -144,7 +155,9 @@ exports[`AST Fixtures legacy-fixtures types conditional-infer AST Alignment - AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [86, 87], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/1-TSESTree-AST.shot index e7d19856275..79117e3178a 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSConditionalType { @@ -82,6 +85,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 119], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/5-AST-Alignment-AST.shot index be2ad0cc13c..ed615cbcd19 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional-with-null/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,109 @@ exports[`AST Fixtures legacy-fixtures types conditional-with-null AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSConditionalType { + type: 'TSConditionalType', + checkType: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [80, 86], + loc: { + start: { column: 7, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + extendsType: TSStringKeyword { + type: 'TSStringKeyword', + + range: [95, 101], + loc: { + start: { column: 22, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + falseType: TSNullKeyword { + type: 'TSNullKeyword', + + range: [114, 118], + loc: { + start: { column: 41, line: 3 }, + end: { column: 45, line: 3 }, + }, + }, + trueType: TSBooleanKeyword { + type: 'TSBooleanKeyword', + + range: [104, 111], + loc: { + start: { column: 31, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [80, 118], + loc: { + start: { column: 7, line: 3 }, + end: { column: 45, line: 3 }, + }, + }, + + range: [78, 118], + loc: { + start: { column: 5, line: 3 }, + end: { column: 45, line: 3 }, + }, + }, + + range: [77, 118], + loc: { + start: { column: 4, line: 3 }, + end: { column: 45, line: 3 }, + }, + }, + init: null, + + range: [77, 118], + loc: { + start: { column: 4, line: 3 }, + end: { column: 45, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 119], + loc: { + start: { column: 0, line: 3 }, + end: { column: 46, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 120], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional/snapshots/1-TSESTree-AST.shot index 49da7018a3f..dd622e60bbc 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSConditionalType { @@ -82,6 +85,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 121], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional/snapshots/5-AST-Alignment-AST.shot index f451cd31629..a9d6aaafa0f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/conditional/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,109 @@ exports[`AST Fixtures legacy-fixtures types conditional AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSConditionalType { + type: 'TSConditionalType', + checkType: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [80, 86], + loc: { + start: { column: 7, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + extendsType: TSStringKeyword { + type: 'TSStringKeyword', + + range: [95, 101], + loc: { + start: { column: 22, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + falseType: TSStringKeyword { + type: 'TSStringKeyword', + + range: [114, 120], + loc: { + start: { column: 41, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + trueType: TSBooleanKeyword { + type: 'TSBooleanKeyword', + + range: [104, 111], + loc: { + start: { column: 31, line: 3 }, + end: { column: 38, line: 3 }, + }, + }, + + range: [80, 120], + loc: { + start: { column: 7, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + + range: [78, 120], + loc: { + start: { column: 5, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + + range: [77, 120], + loc: { + start: { column: 4, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + init: null, + + range: [77, 120], + loc: { + start: { column: 4, line: 3 }, + end: { column: 47, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 121], + loc: { + start: { column: 0, line: 3 }, + end: { column: 48, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 122], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-abstract/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-abstract/snapshots/1-TSESTree-AST.shot index 1b948a21b47..47eb2e99ae5 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-abstract/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-abstract/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSConstructorType { @@ -66,6 +69,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [73, 104], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-abstract/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-abstract/snapshots/5-AST-Alignment-AST.shot index 18d7b8a9fb1..323e019ff1f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-abstract/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-abstract/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types constructor-abstract AST Alignment - declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSConstructorType { @@ -72,6 +75,7 @@ exports[`AST Fixtures legacy-fixtures types constructor-abstract AST Alignment - }, }, ], +- declare: false, kind: 'var', range: [73, 104], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-empty/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-empty/snapshots/1-TSESTree-AST.shot index 97094ac255f..1e308f73b96 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-empty/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-empty/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSConstructorType { @@ -66,6 +69,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [73, 95], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-empty/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-empty/snapshots/5-AST-Alignment-AST.shot index 06360892a57..b396e883fd4 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-empty/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-empty/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types constructor-empty AST Alignment - AS declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSConstructorType { @@ -72,6 +75,7 @@ exports[`AST Fixtures legacy-fixtures types constructor-empty AST Alignment - AS }, }, ], +- declare: false, kind: 'var', range: [73, 95], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-generic/snapshots/1-TSESTree-AST.shot index 37e9d21a8b9..3d53d764c31 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-generic/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "f", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSConstructorType { @@ -20,14 +23,18 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [91, 92], loc: { @@ -63,7 +70,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [97, 98], loc: { @@ -93,7 +102,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [85, 86], loc: { @@ -147,6 +158,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 99], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-generic/snapshots/5-AST-Alignment-AST.shot index fb218b26aa3..83a6dd12943 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-generic/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types constructor-generic AST Alignment - declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'f', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSConstructorType { @@ -25,14 +28,18 @@ exports[`AST Fixtures legacy-fixtures types constructor-generic AST Alignment - + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [91, 92], loc: { @@ -69,7 +76,9 @@ exports[`AST Fixtures legacy-fixtures types constructor-generic AST Alignment - type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [97, 98], loc: { @@ -99,7 +108,9 @@ exports[`AST Fixtures legacy-fixtures types constructor-generic AST Alignment - - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [85, 86], - loc: { @@ -154,6 +165,7 @@ exports[`AST Fixtures legacy-fixtures types constructor-generic AST Alignment - }, }, ], +- declare: false, kind: 'let', range: [73, 99], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/1-TSESTree-AST.shot index 825b95c844b..ae89d92d5e5 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { @@ -58,7 +61,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Array", + optional: false, range: [80, 85], loc: { @@ -136,6 +141,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 104], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/5-AST-Alignment-AST.shot index ec23f3c8380..5432fcbc649 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-in-generic/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types constructor-in-generic AST Alignment declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { @@ -62,7 +65,9 @@ exports[`AST Fixtures legacy-fixtures types constructor-in-generic AST Alignment - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Array', +- optional: false, range: [80, 85], loc: { @@ -142,6 +147,7 @@ exports[`AST Fixtures legacy-fixtures types constructor-in-generic AST Alignment }, }, ], +- declare: false, kind: 'let', range: [73, 104], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-with-rest/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-with-rest/snapshots/1-TSESTree-AST.shot index f64c601255b..c5cb8b15421 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-with-rest/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-with-rest/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "f", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSConstructorType { @@ -22,7 +25,9 @@ Program { type: "RestElement", argument: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [88, 89], loc: { @@ -30,6 +35,8 @@ Program { end: { column: 16, line: 3 }, }, }, + decorators: Array [], + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSArrayType { @@ -113,6 +120,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 109], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-with-rest/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-with-rest/snapshots/5-AST-Alignment-AST.shot index 7dd96ce1e6a..8f5e827d8c8 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-with-rest/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor-with-rest/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types constructor-with-rest AST Alignment declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'f', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSConstructorType { @@ -27,7 +30,9 @@ exports[`AST Fixtures legacy-fixtures types constructor-with-rest AST Alignment type: 'RestElement', argument: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [88, 89], loc: { @@ -35,6 +40,8 @@ exports[`AST Fixtures legacy-fixtures types constructor-with-rest AST Alignment end: { column: 16, line: 3 }, }, }, +- decorators: Array [], +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSArrayType { @@ -119,6 +126,7 @@ exports[`AST Fixtures legacy-fixtures types constructor-with-rest AST Alignment }, }, ], +- declare: false, kind: 'let', range: [73, 109], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor/snapshots/1-TSESTree-AST.shot index b4d3ef6fec7..191654060f6 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "f", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSConstructorType { @@ -20,7 +23,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -48,6 +53,7 @@ Program { }, Identifier { type: "Identifier", + decorators: Array [], name: "b", optional: true, typeAnnotation: TSTypeAnnotation { @@ -124,6 +130,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 116], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor/snapshots/5-AST-Alignment-AST.shot index c5fe0cca283..6514d646011 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/constructor/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types constructor AST Alignment - AST 1`] declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'f', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSConstructorType { @@ -25,7 +28,9 @@ exports[`AST Fixtures legacy-fixtures types constructor AST Alignment - AST 1`] + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -53,6 +58,7 @@ exports[`AST Fixtures legacy-fixtures types constructor AST Alignment - AST 1`] }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', optional: true, typeAnnotation: TSTypeAnnotation { @@ -130,6 +136,7 @@ exports[`AST Fixtures legacy-fixtures types constructor AST Alignment - AST 1`] }, }, ], +- declare: false, kind: 'let', range: [73, 116], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-generic/snapshots/1-TSESTree-AST.shot index a2a6283fff8..be76dcd2cd9 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-generic/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "f", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSFunctionType { @@ -19,14 +22,18 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [87, 88], loc: { @@ -62,7 +69,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [93, 94], loc: { @@ -92,7 +101,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [81, 82], loc: { @@ -146,6 +157,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 95], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-generic/snapshots/5-AST-Alignment-AST.shot index a8213dcf5ab..2aefbc17c98 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-generic/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types function-generic AST Alignment - AST declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'f', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSFunctionType { @@ -24,14 +27,18 @@ exports[`AST Fixtures legacy-fixtures types function-generic AST Alignment - AST + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [87, 88], loc: { @@ -68,7 +75,9 @@ exports[`AST Fixtures legacy-fixtures types function-generic AST Alignment - AST type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [93, 94], loc: { @@ -98,7 +107,9 @@ exports[`AST Fixtures legacy-fixtures types function-generic AST Alignment - AST - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [81, 82], - loc: { @@ -153,6 +164,7 @@ exports[`AST Fixtures legacy-fixtures types function-generic AST Alignment - AST }, }, ], +- declare: false, kind: 'let', range: [73, 95], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/1-TSESTree-AST.shot index c58a7832ac1..d89da0f79e3 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { @@ -57,7 +60,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Array", + optional: false, range: [80, 85], loc: { @@ -134,6 +139,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 98], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/5-AST-Alignment-AST.shot index e36d96ae16a..97aa0da4e4c 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-in-generic/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types function-in-generic AST Alignment - declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { @@ -61,7 +64,9 @@ exports[`AST Fixtures legacy-fixtures types function-in-generic AST Alignment - - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Array', +- optional: false, range: [80, 85], loc: { @@ -140,6 +145,7 @@ exports[`AST Fixtures legacy-fixtures types function-in-generic AST Alignment - }, }, ], +- declare: false, kind: 'let', range: [73, 98], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-array-destruction/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-array-destruction/snapshots/1-TSESTree-AST.shot index 072e8d0b4a7..5994aa1f497 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-array-destruction/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-array-destruction/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [78, 81], loc: { @@ -21,10 +24,13 @@ Program { params: Array [ ArrayPattern { type: "ArrayPattern", + decorators: Array [], elements: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [86, 87], loc: { @@ -33,6 +39,7 @@ Program { }, }, ], + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSAnyKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-array-destruction/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-array-destruction/snapshots/5-AST-Alignment-AST.shot index a786bec4d07..be570c8c543 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-array-destruction/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-array-destruction/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types function-with-array-destruction AST body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [78, 81], loc: { @@ -26,10 +29,13 @@ exports[`AST Fixtures legacy-fixtures types function-with-array-destruction AST + parameters: Array [ ArrayPattern { type: 'ArrayPattern', +- decorators: Array [], elements: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [86, 87], loc: { @@ -38,6 +44,7 @@ exports[`AST Fixtures legacy-fixtures types function-with-array-destruction AST }, }, ], +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSAnyKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-object-destruction/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-object-destruction/snapshots/1-TSESTree-AST.shot index be8e8b7979f..6e76f7356c7 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-object-destruction/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-object-destruction/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [78, 81], loc: { @@ -21,13 +24,17 @@ Program { params: Array [ ObjectPattern { type: "ObjectPattern", + decorators: Array [], + optional: false, properties: Array [ Property { type: "Property", computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [87, 88], loc: { @@ -37,10 +44,13 @@ Program { }, kind: "init", method: false, + optional: false, shorthand: true, value: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [87, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-object-destruction/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-object-destruction/snapshots/5-AST-Alignment-AST.shot index 2f06b281d40..8ffbb928e8a 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-object-destruction/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-object-destruction/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types function-with-object-destruction AST body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [78, 81], loc: { @@ -26,13 +29,17 @@ exports[`AST Fixtures legacy-fixtures types function-with-object-destruction AST + parameters: Array [ ObjectPattern { type: 'ObjectPattern', +- decorators: Array [], +- optional: false, properties: Array [ Property { type: 'Property', computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [87, 88], loc: { @@ -42,10 +49,13 @@ exports[`AST Fixtures legacy-fixtures types function-with-object-destruction AST }, kind: 'init', method: false, +- optional: false, shorthand: true, value: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [87, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-rest/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-rest/snapshots/1-TSESTree-AST.shot index 02d79101ce8..8786a1e766c 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-rest/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-rest/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "f", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSFunctionType { @@ -21,7 +24,9 @@ Program { type: "RestElement", argument: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [84, 85], loc: { @@ -29,6 +34,8 @@ Program { end: { column: 12, line: 3 }, }, }, + decorators: Array [], + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSArrayType { @@ -112,6 +119,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 105], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-rest/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-rest/snapshots/5-AST-Alignment-AST.shot index 7a302d9a418..90262f9c0dc 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-rest/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-rest/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types function-with-rest AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'f', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSFunctionType { @@ -26,7 +29,9 @@ exports[`AST Fixtures legacy-fixtures types function-with-rest AST Alignment - A type: 'RestElement', argument: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [84, 85], loc: { @@ -34,6 +39,8 @@ exports[`AST Fixtures legacy-fixtures types function-with-rest AST Alignment - A end: { column: 12, line: 3 }, }, }, +- decorators: Array [], +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSArrayType { @@ -118,6 +125,7 @@ exports[`AST Fixtures legacy-fixtures types function-with-rest AST Alignment - A }, }, ], +- declare: false, kind: 'let', range: [73, 105], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/1-TSESTree-AST.shot index 01c4c33b0b9..7e0bf6843c5 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "f", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSFunctionType { @@ -19,7 +22,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "this", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -94,6 +99,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 103], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/5-AST-Alignment-AST.shot index 6687e26e8c8..f6147ae4510 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function-with-this/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types function-with-this AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'f', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSFunctionType { @@ -24,7 +27,9 @@ exports[`AST Fixtures legacy-fixtures types function-with-this AST Alignment - A + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'this', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -100,6 +105,7 @@ exports[`AST Fixtures legacy-fixtures types function-with-this AST Alignment - A }, }, ], +- declare: false, kind: 'let', range: [73, 103], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function/snapshots/1-TSESTree-AST.shot index d9cfb96a334..c1b4bb21c35 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "f", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSFunctionType { @@ -19,7 +22,9 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -47,6 +52,7 @@ Program { }, Identifier { type: "Identifier", + decorators: Array [], name: "b", optional: true, typeAnnotation: TSTypeAnnotation { @@ -123,6 +129,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 112], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function/snapshots/5-AST-Alignment-AST.shot index 41bd32adba5..367d12afbcb 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/function/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/function/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types function AST Alignment - AST 1`] = ` declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'f', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSFunctionType { @@ -24,7 +27,9 @@ exports[`AST Fixtures legacy-fixtures types function AST Alignment - AST 1`] = ` + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSNumberKeyword { @@ -52,6 +57,7 @@ exports[`AST Fixtures legacy-fixtures types function AST Alignment - AST 1`] = ` }, Identifier { type: 'Identifier', +- decorators: Array [], name: 'b', optional: true, typeAnnotation: TSTypeAnnotation { @@ -129,6 +135,7 @@ exports[`AST Fixtures legacy-fixtures types function AST Alignment - AST 1`] = ` }, }, ], +- declare: false, kind: 'let', range: [73, 112], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-readonly/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-readonly/snapshots/1-TSESTree-AST.shot index a3a48e3bbab..3915ffce55b 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-readonly/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-readonly/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [78, 81], loc: { @@ -24,7 +27,9 @@ Program { parameters: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "key", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -52,6 +57,7 @@ Program { }, ], readonly: true, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-readonly/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-readonly/snapshots/5-AST-Alignment-AST.shot index 0500b9d57fb..7bb45645947 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-readonly/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-readonly/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,113 @@ exports[`AST Fixtures legacy-fixtures types index-signature-readonly AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: 'TSTypeLiteral', + members: Array [ + TSIndexSignature { + type: 'TSIndexSignature', + parameters: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'key', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [103, 109], + loc: { + start: { column: 17, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + + range: [101, 109], + loc: { + start: { column: 15, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + + range: [98, 109], + loc: { + start: { column: 12, line: 4 }, + end: { column: 23, line: 4 }, + }, + }, + ], + readonly: true, +- static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [112, 118], + loc: { + start: { column: 26, line: 4 }, + end: { column: 32, line: 4 }, + }, + }, + + range: [110, 118], + loc: { + start: { column: 24, line: 4 }, + end: { column: 32, line: 4 }, + }, + }, + + range: [88, 119], + loc: { + start: { column: 2, line: 4 }, + end: { column: 33, line: 4 }, + }, + }, + ], + + range: [84, 121], + loc: { + start: { column: 11, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + + range: [73, 122], + loc: { + start: { column: 0, line: 3 }, + end: { column: 2, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 123], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-without-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-without-type/snapshots/1-TSESTree-AST.shot index 1251a19e63b..ccaeff23f2b 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-without-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-without-type/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [78, 81], loc: { @@ -24,7 +27,9 @@ Program { parameters: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -51,6 +56,8 @@ Program { }, }, ], + readonly: false, + static: false, range: [88, 100], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-without-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-without-type/snapshots/5-AST-Alignment-AST.shot index 5f191002668..bc1599183a9 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-without-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature-without-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,95 @@ exports[`AST Fixtures legacy-fixtures types index-signature-without-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: 'TSTypeLiteral', + members: Array [ + TSIndexSignature { + type: 'TSIndexSignature', + parameters: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [92, 98], + loc: { + start: { column: 6, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + + range: [90, 98], + loc: { + start: { column: 4, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + + range: [89, 98], + loc: { + start: { column: 3, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + ], +- readonly: false, +- static: false, + + range: [88, 100], + loc: { + start: { column: 2, line: 4 }, + end: { column: 14, line: 4 }, + }, + }, + ], + + range: [84, 102], + loc: { + start: { column: 11, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + + range: [73, 103], + loc: { + start: { column: 0, line: 3 }, + end: { column: 2, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 104], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature/snapshots/1-TSESTree-AST.shot index 1ab68c70a72..62e8e294bcd 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [78, 81], loc: { @@ -24,7 +27,9 @@ Program { parameters: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { @@ -51,6 +56,8 @@ Program { }, }, ], + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSStringKeyword { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature/snapshots/5-AST-Alignment-AST.shot index 4382f42ebd5..39cb215c305 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/index-signature/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,113 @@ exports[`AST Fixtures legacy-fixtures types index-signature AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSTypeLiteral { + type: 'TSTypeLiteral', + members: Array [ + TSIndexSignature { + type: 'TSIndexSignature', + parameters: Array [ + Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [92, 98], + loc: { + start: { column: 6, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + + range: [90, 98], + loc: { + start: { column: 4, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + + range: [89, 98], + loc: { + start: { column: 3, line: 4 }, + end: { column: 12, line: 4 }, + }, + }, + ], +- readonly: false, +- static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [101, 107], + loc: { + start: { column: 15, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + + range: [99, 107], + loc: { + start: { column: 13, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + + range: [88, 108], + loc: { + start: { column: 2, line: 4 }, + end: { column: 22, line: 4 }, + }, + }, + ], + + range: [84, 110], + loc: { + start: { column: 11, line: 3 }, + end: { column: 1, line: 5 }, + }, + }, + + range: [73, 111], + loc: { + start: { column: 0, line: 3 }, + end: { column: 2, line: 5 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 112], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 6 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/indexed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/indexed/snapshots/1-TSESTree-AST.shot index 5081b669353..8f91bb06bb1 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/indexed/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/indexed/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSIndexedAccessType { @@ -20,7 +23,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "K", + optional: false, range: [82, 83], loc: { @@ -39,7 +44,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [80, 81], loc: { @@ -84,6 +91,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 85], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/indexed/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/indexed/snapshots/5-AST-Alignment-AST.shot index cebd390f70d..13b1dbd2526 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/indexed/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/indexed/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,115 @@ exports[`AST Fixtures legacy-fixtures types indexed AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSIndexedAccessType { + type: 'TSIndexedAccessType', + indexType: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'K', +- optional: false, + + range: [82, 83], + loc: { + start: { column: 9, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + + range: [82, 83], + loc: { + start: { column: 9, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + objectType: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'T', +- optional: false, + + range: [80, 81], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [80, 81], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [80, 84], + loc: { + start: { column: 7, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + + range: [78, 84], + loc: { + start: { column: 5, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + + range: [77, 84], + loc: { + start: { column: 4, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + init: null, + + range: [77, 84], + loc: { + start: { column: 4, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 85], + loc: { + start: { column: 0, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 86], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/interface-with-accessors/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/interface-with-accessors/snapshots/1-TSESTree-AST.shot index 91fce2f9141..bebf5384c35 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/interface-with-accessors/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/interface-with-accessors/snapshots/1-TSESTree-AST.shot @@ -14,7 +14,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "size", + optional: false, range: [97, 101], loc: { @@ -23,7 +25,9 @@ Program { }, }, kind: "get", + optional: false, params: Array [], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -42,6 +46,7 @@ Program { end: { column: 20, line: 4 }, }, }, + static: false, range: [93, 112], loc: { @@ -54,7 +59,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "size", + optional: false, range: [119, 123], loc: { @@ -63,10 +70,13 @@ Program { }, }, kind: "set", + optional: false, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "value", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnionType { @@ -122,6 +132,8 @@ Program { }, }, ], + readonly: false, + static: false, range: [115, 158], loc: { @@ -137,9 +149,13 @@ Program { end: { column: 1, line: 6 }, }, }, + declare: false, + extends: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Thing", + optional: false, range: [83, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/interface-with-accessors/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/interface-with-accessors/snapshots/5-AST-Alignment-AST.shot index 385e910cd90..c9675620d00 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/interface-with-accessors/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/interface-with-accessors/snapshots/5-AST-Alignment-AST.shot @@ -18,7 +18,9 @@ exports[`AST Fixtures legacy-fixtures types interface-with-accessors AST Alignme computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'size', +- optional: false, range: [97, 101], loc: { @@ -27,7 +29,9 @@ exports[`AST Fixtures legacy-fixtures types interface-with-accessors AST Alignme }, }, kind: 'get', +- optional: false, - params: Array [], +- readonly: false, - returnType: TSTypeAnnotation { + parameters: Array [], + typeAnnotation: TSTypeAnnotation { @@ -48,6 +52,7 @@ exports[`AST Fixtures legacy-fixtures types interface-with-accessors AST Alignme end: { column: 20, line: 4 }, }, }, +- static: false, range: [93, 112], loc: { @@ -60,7 +65,9 @@ exports[`AST Fixtures legacy-fixtures types interface-with-accessors AST Alignme computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'size', +- optional: false, range: [119, 123], loc: { @@ -69,11 +76,14 @@ exports[`AST Fixtures legacy-fixtures types interface-with-accessors AST Alignme }, }, kind: 'set', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'value', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSUnionType { @@ -129,6 +139,8 @@ exports[`AST Fixtures legacy-fixtures types interface-with-accessors AST Alignme }, }, ], +- readonly: false, +- static: false, range: [115, 158], loc: { @@ -144,9 +156,13 @@ exports[`AST Fixtures legacy-fixtures types interface-with-accessors AST Alignme end: { column: 1, line: 6 }, }, }, +- declare: false, +- extends: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Thing', +- optional: false, range: [83, 88], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/1-TSESTree-AST.shot index 0bafaaee4ce..40ce1b0d088 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "LinkedList", + optional: false, range: [78, 88], loc: { @@ -23,7 +26,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [94, 95], loc: { @@ -46,7 +51,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "next", + optional: false, range: [100, 104], loc: { @@ -54,6 +61,9 @@ Program { end: { column: 31, line: 3 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { @@ -65,7 +75,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [117, 118], loc: { @@ -90,7 +102,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "LinkedList", + optional: false, range: [106, 116], loc: { @@ -105,7 +119,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [117, 118], loc: { @@ -173,7 +189,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [89, 90], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/5-AST-Alignment-AST.shot index 17ec5b0d84b..c2470729a2c 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/intersection-type/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types intersection-type AST Alignment - AS body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'LinkedList', +- optional: false, range: [78, 88], loc: { @@ -27,7 +30,9 @@ exports[`AST Fixtures legacy-fixtures types intersection-type AST Alignment - AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [94, 95], loc: { @@ -50,7 +55,9 @@ exports[`AST Fixtures legacy-fixtures types intersection-type AST Alignment - AS computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'next', +- optional: false, range: [100, 104], loc: { @@ -58,6 +65,9 @@ exports[`AST Fixtures legacy-fixtures types intersection-type AST Alignment - AS end: { column: 31, line: 3 }, }, }, +- optional: false, +- readonly: false, +- static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { @@ -69,7 +79,9 @@ exports[`AST Fixtures legacy-fixtures types intersection-type AST Alignment - AS - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [117, 118], - loc: { @@ -94,7 +106,9 @@ exports[`AST Fixtures legacy-fixtures types intersection-type AST Alignment - AS - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'LinkedList', +- optional: false, range: [106, 116], loc: { @@ -109,7 +123,9 @@ exports[`AST Fixtures legacy-fixtures types intersection-type AST Alignment - AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [117, 118], loc: { @@ -177,7 +193,9 @@ exports[`AST Fixtures legacy-fixtures types intersection-type AST Alignment - AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [89, 90], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number-negative/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number-negative/snapshots/1-TSESTree-AST.shot index f1220c7e2ea..d136da62d4f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number-negative/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number-negative/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSLiteralType { @@ -68,6 +71,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 83], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number-negative/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number-negative/snapshots/5-AST-Alignment-AST.shot index 3d4e5e78f7e..0c3009c51c5 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number-negative/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number-negative/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,95 @@ exports[`AST Fixtures legacy-fixtures types literal-number-negative AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: UnaryExpression { + type: 'UnaryExpression', + argument: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [81, 82], + loc: { + start: { column: 8, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + operator: '-', + prefix: true, + + range: [80, 82], + loc: { + start: { column: 7, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + + range: [80, 82], + loc: { + start: { column: 7, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + + range: [78, 82], + loc: { + start: { column: 5, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + + range: [77, 82], + loc: { + start: { column: 4, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + init: null, + + range: [77, 82], + loc: { + start: { column: 4, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 83], + loc: { + start: { column: 0, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 84], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number/snapshots/1-TSESTree-AST.shot index b4c18ac1eca..7e0bbd95e68 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSLiteralType { @@ -57,6 +60,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 82], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number/snapshots/5-AST-Alignment-AST.shot index 8c89c0f442e..aae165b9340 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-number/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,84 @@ exports[`AST Fixtures legacy-fixtures types literal-number AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: '0', + value: 0, + + range: [80, 81], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [80, 81], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [77, 81], + loc: { + start: { column: 4, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + init: null, + + range: [77, 81], + loc: { + start: { column: 4, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 82], + loc: { + start: { column: 0, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 83], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-string/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-string/snapshots/1-TSESTree-AST.shot index 0193d55beb6..f64604d17dd 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-string/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-string/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSLiteralType { @@ -57,6 +60,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 86], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-string/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-string/snapshots/5-AST-Alignment-AST.shot index e1c0de62017..07976d2dd8c 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-string/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/literal-string/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,84 @@ exports[`AST Fixtures legacy-fixtures types literal-string AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: '\\\\'foo\\\\'', + value: 'foo', + + range: [80, 85], + loc: { + start: { column: 7, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + + range: [80, 85], + loc: { + start: { column: 7, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + + range: [78, 85], + loc: { + start: { column: 5, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + + range: [77, 85], + loc: { + start: { column: 4, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + init: null, + + range: [77, 85], + loc: { + start: { column: 4, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 86], + loc: { + start: { column: 0, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 87], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-named-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-named-type/snapshots/1-TSESTree-AST.shot index 6537caf714f..ff2a8083a1c 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-named-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-named-type/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Test", + optional: false, range: [78, 82], loc: { @@ -44,7 +47,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "P", + optional: false, range: [117, 118], loc: { @@ -63,7 +68,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [115, 116], loc: { @@ -94,7 +101,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [104, 105], loc: { @@ -119,7 +128,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "P", + optional: false, range: [93, 94], loc: { @@ -150,7 +161,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [83, 84], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-named-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-named-type/snapshots/5-AST-Alignment-AST.shot index a57f192e4a2..bb8d49d0d04 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-named-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-named-type/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types mapped-named-type AST Alignment - AS body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Test', +- optional: false, range: [78, 82], loc: { @@ -48,7 +51,9 @@ exports[`AST Fixtures legacy-fixtures types mapped-named-type AST Alignment - AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'P', +- optional: false, range: [117, 118], loc: { @@ -67,7 +72,9 @@ exports[`AST Fixtures legacy-fixtures types mapped-named-type AST Alignment - AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [115, 116], loc: { @@ -98,7 +105,9 @@ exports[`AST Fixtures legacy-fixtures types mapped-named-type AST Alignment - AS type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [104, 105], loc: { @@ -123,7 +132,9 @@ exports[`AST Fixtures legacy-fixtures types mapped-named-type AST Alignment - AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'P', +- optional: false, - - range: [93, 94], - loc: { @@ -155,7 +166,9 @@ exports[`AST Fixtures legacy-fixtures types mapped-named-type AST Alignment - AS - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [83, 84], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-minus/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-minus/snapshots/1-TSESTree-AST.shot index 20121cf188a..f8ba6ac2f54 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-minus/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-minus/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "map", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSMappedType { @@ -42,7 +45,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "P", + optional: false, range: [95, 96], loc: { @@ -88,6 +93,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 120], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-minus/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-minus/snapshots/5-AST-Alignment-AST.shot index 65aeb0689ca..15911525a96 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-minus/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-minus/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types mapped-readonly-minus AST Alignment declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'map', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSMappedType { @@ -46,7 +49,9 @@ exports[`AST Fixtures legacy-fixtures types mapped-readonly-minus AST Alignment - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'P', +- optional: false, - - range: [95, 96], - loc: { @@ -93,6 +98,7 @@ exports[`AST Fixtures legacy-fixtures types mapped-readonly-minus AST Alignment }, }, ], +- declare: false, kind: 'let', range: [73, 120], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-plus/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-plus/snapshots/1-TSESTree-AST.shot index ad99fda9528..54f6f55f7eb 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-plus/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-plus/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "map", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSMappedType { @@ -42,7 +45,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "P", + optional: false, range: [95, 96], loc: { @@ -88,6 +93,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 120], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-plus/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-plus/snapshots/5-AST-Alignment-AST.shot index 3148bb5b740..8b11516092e 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-plus/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly-plus/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types mapped-readonly-plus AST Alignment - declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'map', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSMappedType { @@ -46,7 +49,9 @@ exports[`AST Fixtures legacy-fixtures types mapped-readonly-plus AST Alignment - - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'P', +- optional: false, - - range: [95, 96], - loc: { @@ -93,6 +98,7 @@ exports[`AST Fixtures legacy-fixtures types mapped-readonly-plus AST Alignment - }, }, ], +- declare: false, kind: 'let', range: [73, 120], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly/snapshots/1-TSESTree-AST.shot index d69be386629..18404758afb 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "map", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSMappedType { @@ -42,7 +45,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "P", + optional: false, range: [94, 95], loc: { @@ -88,6 +93,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly/snapshots/5-AST-Alignment-AST.shot index 75e06a9b433..b08cb1ff976 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-readonly/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types mapped-readonly AST Alignment - AST declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'map', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSMappedType { @@ -46,7 +49,9 @@ exports[`AST Fixtures legacy-fixtures types mapped-readonly AST Alignment - AST - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'P', +- optional: false, - - range: [94, 95], - loc: { @@ -93,6 +98,7 @@ exports[`AST Fixtures legacy-fixtures types mapped-readonly AST Alignment - AST }, }, ], +- declare: false, kind: 'let', range: [73, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-untypped/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-untypped/snapshots/1-TSESTree-AST.shot index aedabb491bc..8d025f03af1 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-untypped/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-untypped/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "map", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSMappedType { @@ -31,7 +34,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "P", + optional: false, range: [85, 86], loc: { @@ -77,6 +82,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 100], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-untypped/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-untypped/snapshots/5-AST-Alignment-AST.shot index 03f4bb194f8..3286599930a 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-untypped/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped-untypped/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types mapped-untypped AST Alignment - AST declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'map', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSMappedType { @@ -35,7 +38,9 @@ exports[`AST Fixtures legacy-fixtures types mapped-untypped AST Alignment - AST - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'P', +- optional: false, - - range: [85, 86], - loc: { @@ -82,6 +87,7 @@ exports[`AST Fixtures legacy-fixtures types mapped-untypped AST Alignment - AST }, }, ], +- declare: false, kind: 'let', range: [73, 100], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped/snapshots/1-TSESTree-AST.shot index 95ee43a3255..93162192958 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "map", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSMappedType { @@ -40,7 +43,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "P", + optional: false, range: [85, 86], loc: { @@ -86,6 +91,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 108], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped/snapshots/5-AST-Alignment-AST.shot index c46578e24d0..a484f19523c 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/mapped/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types mapped AST Alignment - AST 1`] = ` declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'map', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSMappedType { @@ -44,7 +47,9 @@ exports[`AST Fixtures legacy-fixtures types mapped AST Alignment - AST 1`] = ` - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'P', +- optional: false, - - range: [85, 86], - loc: { @@ -91,6 +96,7 @@ exports[`AST Fixtures legacy-fixtures types mapped AST Alignment - AST 1`] = ` }, }, ], +- declare: false, kind: 'let', range: [73, 108], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/1-TSESTree-AST.shot index edaba8621f1..c53a6f6054a 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/5-AST-Alignment-AST.shot index 87b23389093..80ae05900af 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/nested-types/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types nested-types AST Alignment - AST 1`] body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Foo', +- optional: false, range: [78, 81], loc: { @@ -179,17 +182,7 @@ exports[`AST Fixtures legacy-fixtures types nested-types AST Alignment - AST 1`] + types: Array [ + TSNullKeyword { + type: 'TSNullKeyword', - -- range: [139, 143], -- loc: { -- start: { column: 23, line: 5 }, -- end: { column: 27, line: 5 }, -- }, -- }, -- TSArrayType { -- type: 'TSArrayType', -- elementType: TSBooleanKeyword { -- type: 'TSBooleanKeyword', ++ + range: [139, 143], + loc: { + start: { column: 23, line: 5 }, @@ -201,17 +194,27 @@ exports[`AST Fixtures legacy-fixtures types nested-types AST Alignment - AST 1`] + elementType: TSBooleanKeyword { + type: 'TSBooleanKeyword', -- range: [146, 153], -- loc: { -- start: { column: 30, line: 5 }, -- end: { column: 37, line: 5 }, +- range: [139, 143], +- loc: { +- start: { column: 23, line: 5 }, +- end: { column: 27, line: 5 }, +- }, +- }, +- TSArrayType { +- type: 'TSArrayType', +- elementType: TSBooleanKeyword { +- type: 'TSBooleanKeyword', + range: [146, 153], + loc: { + start: { column: 30, line: 5 }, + end: { column: 37, line: 5 }, + }, + }, -+ + +- range: [146, 153], +- loc: { +- start: { column: 30, line: 5 }, +- end: { column: 37, line: 5 }, + range: [146, 155], + loc: { + start: { column: 30, line: 5 }, @@ -241,54 +244,54 @@ exports[`AST Fixtures legacy-fixtures types nested-types AST Alignment - AST 1`] + end: { column: 40, line: 5 }, + }, }, -+ ], -+ -+ range: [126, 156], -+ loc: { -+ start: { column: 10, line: 5 }, -+ end: { column: 40, line: 5 }, - }, +- }, - ], -+ }, -+ ], ++ ], - range: [126, 156], - loc: { - start: { column: 10, line: 5 }, - end: { column: 40, line: 5 }, -- }, ++ range: [126, 156], ++ loc: { ++ start: { column: 10, line: 5 }, ++ end: { column: 40, line: 5 }, ++ }, + }, ++ ], ++ + range: [121, 157], + loc: { + start: { column: 5, line: 5 }, + end: { column: 41, line: 5 }, }, - ], -- ++ }, ++ TSTypeLiteral { ++ type: 'TSTypeLiteral', ++ members: Array [], + - range: [121, 157], - loc: { - start: { column: 5, line: 5 }, - end: { column: 41, line: 5 }, ++ range: [160, 162], ++ loc: { ++ start: { column: 44, line: 5 }, ++ end: { column: 46, line: 5 }, ++ }, }, - }, - TSTypeLiteral { - type: 'TSTypeLiteral', - members: Array [], -+ TSTypeLiteral { -+ type: 'TSTypeLiteral', -+ members: Array [], ++ ], - range: [160, 162], - loc: { - start: { column: 44, line: 5 }, - end: { column: 46, line: 5 }, -+ range: [160, 162], -+ loc: { -+ start: { column: 44, line: 5 }, -+ end: { column: 46, line: 5 }, -+ }, - }, -+ ], -+ +- }, + range: [121, 162], + loc: { + start: { column: 5, line: 5 }, diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/object-literal-type-with-accessors/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/object-literal-type-with-accessors/snapshots/1-TSESTree-AST.shot index f72d70c0845..664775f14e8 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/object-literal-type-with-accessors/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/object-literal-type-with-accessors/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Thing", + optional: false, range: [78, 83], loc: { @@ -24,7 +27,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "size", + optional: false, range: [94, 98], loc: { @@ -33,7 +38,9 @@ Program { }, }, kind: "get", + optional: false, params: Array [], + readonly: false, returnType: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -52,6 +59,7 @@ Program { end: { column: 20, line: 4 }, }, }, + static: false, range: [90, 109], loc: { @@ -64,7 +72,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "size", + optional: false, range: [116, 120], loc: { @@ -73,10 +83,13 @@ Program { }, }, kind: "set", + optional: false, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "value", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnionType { @@ -132,6 +145,8 @@ Program { }, }, ], + readonly: false, + static: false, range: [112, 155], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/object-literal-type-with-accessors/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/object-literal-type-with-accessors/snapshots/5-AST-Alignment-AST.shot index d1b1d336bcf..f2c26b3d6fd 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/object-literal-type-with-accessors/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/object-literal-type-with-accessors/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types object-literal-type-with-accessors A body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Thing', +- optional: false, range: [78, 83], loc: { @@ -28,7 +31,9 @@ exports[`AST Fixtures legacy-fixtures types object-literal-type-with-accessors A computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'size', +- optional: false, range: [94, 98], loc: { @@ -37,7 +42,9 @@ exports[`AST Fixtures legacy-fixtures types object-literal-type-with-accessors A }, }, kind: 'get', +- optional: false, - params: Array [], +- readonly: false, - returnType: TSTypeAnnotation { + parameters: Array [], + typeAnnotation: TSTypeAnnotation { @@ -58,6 +65,7 @@ exports[`AST Fixtures legacy-fixtures types object-literal-type-with-accessors A end: { column: 20, line: 4 }, }, }, +- static: false, range: [90, 109], loc: { @@ -70,7 +78,9 @@ exports[`AST Fixtures legacy-fixtures types object-literal-type-with-accessors A computed: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'size', +- optional: false, range: [116, 120], loc: { @@ -79,11 +89,14 @@ exports[`AST Fixtures legacy-fixtures types object-literal-type-with-accessors A }, }, kind: 'set', +- optional: false, - params: Array [ + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'value', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSUnionType { @@ -139,6 +152,8 @@ exports[`AST Fixtures legacy-fixtures types object-literal-type-with-accessors A }, }, ], +- readonly: false, +- static: false, range: [112, 155], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-and-out/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-and-out/snapshots/1-TSESTree-AST.shot index f224655bb63..f2bd1b7b3d5 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-and-out/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-and-out/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Mapper", + optional: false, range: [78, 84], loc: { @@ -21,14 +24,18 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [104, 105], loc: { @@ -64,7 +71,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [110, 111], loc: { @@ -101,7 +110,9 @@ Program { in: true, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [88, 89], loc: { @@ -122,7 +133,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "U", + optional: false, range: [95, 96], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-and-out/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-and-out/snapshots/5-AST-Alignment-AST.shot index 0acb047d675..b617900bf96 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-and-out/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-and-out/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in-and-out AST Ali body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Mapper', +- optional: false, range: [78, 84], loc: { @@ -26,14 +29,18 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in-and-out AST Ali + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [104, 105], loc: { @@ -70,7 +77,9 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in-and-out AST Ali type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'U', +- optional: false, range: [110, 111], loc: { @@ -107,7 +116,9 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in-and-out AST Ali in: true, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [88, 89], - loc: { @@ -129,7 +140,9 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in-and-out AST Ali - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'U', +- optional: false, - - range: [95, 96], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-out/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-out/snapshots/1-TSESTree-AST.shot index 86e8cc26e85..920c29d50a7 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-out/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-out/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Processor", + optional: false, range: [78, 87], loc: { @@ -21,14 +24,18 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [104, 105], loc: { @@ -64,7 +71,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [110, 111], loc: { @@ -101,7 +110,9 @@ Program { in: true, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [95, 96], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-out/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-out/snapshots/5-AST-Alignment-AST.shot index c8f77719ef7..7867eef181c 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-out/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in-out/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in-out AST Alignme body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Processor', +- optional: false, range: [78, 87], loc: { @@ -26,14 +29,18 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in-out AST Alignme + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [104, 105], loc: { @@ -70,7 +77,9 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in-out AST Alignme type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [110, 111], loc: { @@ -107,7 +116,9 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in-out AST Alignme in: true, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [95, 96], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in/snapshots/1-TSESTree-AST.shot index 101936bcbab..5cea6ae6618 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Consumer", + optional: false, range: [78, 86], loc: { @@ -21,14 +24,18 @@ Program { params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [99, 100], loc: { @@ -91,7 +98,9 @@ Program { in: true, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [90, 91], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in/snapshots/5-AST-Alignment-AST.shot index 20b933b3fd6..4c4970b8b15 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-in/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in AST Alignment - body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Consumer', +- optional: false, range: [78, 86], loc: { @@ -26,14 +29,18 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in AST Alignment - + parameters: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [99, 100], loc: { @@ -97,7 +104,9 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-in AST Alignment - in: true, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [90, 91], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-out/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-out/snapshots/1-TSESTree-AST.shot index 192a30ecd8b..7217184c639 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-out/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-out/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Provider", + optional: false, range: [78, 86], loc: { @@ -25,7 +28,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [102, 103], loc: { @@ -62,7 +67,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [91, 92], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-out/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-out/snapshots/5-AST-Alignment-AST.shot index ae55b74f2dc..18c20b88f91 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-out/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/optional-variance-out/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-out AST Alignment body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Provider', +- optional: false, range: [78, 86], loc: { @@ -31,7 +34,9 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-out AST Alignment type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [102, 103], loc: { @@ -68,7 +73,9 @@ exports[`AST Fixtures legacy-fixtures types optional-variance-out AST Alignment - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [91, 92], - loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/parenthesized-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/parenthesized-type/snapshots/1-TSESTree-AST.shot index 6c3c6e241e0..6cb95c09f46 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/parenthesized-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/parenthesized-type/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/parenthesized-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/parenthesized-type/snapshots/5-AST-Alignment-AST.shot index 2a275a36440..85783e1a93c 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/parenthesized-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/parenthesized-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,70 @@ exports[`AST Fixtures legacy-fixtures types parenthesized-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSUnionType { + type: 'TSUnionType', + types: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [93, 99], + loc: { + start: { column: 20, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + ], + + range: [84, 99], + loc: { + start: { column: 11, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + + range: [73, 100], + loc: { + start: { column: 0, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 101], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/1-TSESTree-AST.shot index 753128d5502..41c0557f1e7 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { @@ -43,7 +46,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Array", + optional: false, range: [86, 91], loc: { @@ -88,7 +93,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Array", + optional: false, range: [80, 85], loc: { @@ -123,7 +130,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Array", + optional: false, range: [86, 91], loc: { @@ -196,6 +205,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 101], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/5-AST-Alignment-AST.shot index 43214d5f73f..103c3096381 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic-nested/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types reference-generic-nested AST Alignme declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { @@ -47,7 +50,9 @@ exports[`AST Fixtures legacy-fixtures types reference-generic-nested AST Alignme - }, - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'Array', +- optional: false, - - range: [86, 91], - loc: { @@ -92,7 +97,9 @@ exports[`AST Fixtures legacy-fixtures types reference-generic-nested AST Alignme - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Array', +- optional: false, range: [80, 85], loc: { @@ -127,7 +134,9 @@ exports[`AST Fixtures legacy-fixtures types reference-generic-nested AST Alignme - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Array', +- optional: false, range: [86, 91], loc: { @@ -200,6 +209,7 @@ exports[`AST Fixtures legacy-fixtures types reference-generic-nested AST Alignme }, }, ], +- declare: false, kind: 'let', range: [73, 101], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/1-TSESTree-AST.shot index 1740c35076c..e5f3f624be1 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { @@ -38,7 +41,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Array", + optional: false, range: [80, 85], loc: { @@ -96,6 +101,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 94], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/5-AST-Alignment-AST.shot index 998644e9180..d154684870e 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference-generic/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types reference-generic AST Alignment - AS declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { @@ -42,7 +45,9 @@ exports[`AST Fixtures legacy-fixtures types reference-generic AST Alignment - AS - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Array', +- optional: false, range: [80, 85], loc: { @@ -100,6 +105,7 @@ exports[`AST Fixtures legacy-fixtures types reference-generic AST Alignment - AS }, }, ], +- declare: false, kind: 'let', range: [73, 94], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference/snapshots/1-TSESTree-AST.shot index 110f172a2dc..5d23f966114 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference/snapshots/1-TSESTree-AST.shot @@ -9,16 +9,21 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [80, 81], loc: { @@ -56,6 +61,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 82], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference/snapshots/5-AST-Alignment-AST.shot index c396b9e2ddb..2d73832918f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/reference/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,85 @@ exports[`AST Fixtures legacy-fixtures types reference AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'T', +- optional: false, + + range: [80, 81], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [80, 81], + loc: { + start: { column: 7, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + + range: [77, 81], + loc: { + start: { column: 4, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + init: null, + + range: [77, 81], + loc: { + start: { column: 4, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 82], + loc: { + start: { column: 0, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 83], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-1/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-1/snapshots/1-TSESTree-AST.shot index 638e7a32809..761cd814aaa 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-1/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-1/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [78, 79], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-1/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-1/snapshots/5-AST-Alignment-AST.shot index e85a5a9b7bf..b07fdd831c6 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-1/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-1/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,76 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-1 AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'T', +- optional: false, + + range: [78, 79], + loc: { + start: { column: 5, line: 3 }, + end: { column: 6, line: 3 }, + }, + }, + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: TemplateLiteral { + type: 'TemplateLiteral', + expressions: Array [], + quasis: Array [ + TemplateElement { + type: 'TemplateElement', + tail: true, + value: Object { + 'cooked': 'foo', + 'raw': 'foo', + }, + + range: [82, 87], + loc: { + start: { column: 9, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + ], + + range: [82, 87], + loc: { + start: { column: 9, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [82, 87], + loc: { + start: { column: 9, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [73, 88], + loc: { + start: { column: 0, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 89], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-2/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-2/snapshots/1-TSESTree-AST.shot index 7e76c7e53fa..5595230d7a5 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-2/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-2/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [78, 79], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-2/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-2/snapshots/5-AST-Alignment-AST.shot index 70a2fe689f3..24e70d4febe 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-2/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-2/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-2 AST Alignmen body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'T', +- optional: false, range: [78, 79], loc: { @@ -30,18 +33,7 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-2 AST Alignmen - 'cooked': 'foo', - 'raw': 'foo', - }, -+ typeAnnotation: TSLiteralType { -+ type: 'TSLiteralType', -+ literal: TemplateLiteral { -+ type: 'TemplateLiteral', -+ expressions: Array [ -+ TSLiteralType { -+ type: 'TSLiteralType', -+ literal: Literal { -+ type: 'Literal', -+ raw: '\\\\'bar\\\\'', -+ value: 'bar', - +- - range: [82, 88], - loc: { - start: { column: 9, line: 3 }, @@ -55,12 +47,17 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-2 AST Alignmen - 'cooked': '', - 'raw': '', - }, -+ range: [88, 93], -+ loc: { -+ start: { column: 15, line: 3 }, -+ end: { column: 20, line: 3 }, -+ }, -+ }, ++ typeAnnotation: TSLiteralType { ++ type: 'TSLiteralType', ++ literal: TemplateLiteral { ++ type: 'TemplateLiteral', ++ expressions: Array [ ++ TSLiteralType { ++ type: 'TSLiteralType', ++ literal: Literal { ++ type: 'Literal', ++ raw: '\\\\'bar\\\\'', ++ value: 'bar', - range: [93, 95], - loc: { @@ -76,7 +73,13 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-2 AST Alignmen - type: 'Literal', - raw: '\\\\'bar\\\\'', - value: 'bar', -- ++ range: [88, 93], ++ loc: { ++ start: { column: 15, line: 3 }, ++ end: { column: 20, line: 3 }, ++ }, ++ }, + range: [88, 93], loc: { start: { column: 15, line: 3 }, @@ -102,7 +105,7 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-2 AST Alignmen + start: { column: 9, line: 3 }, + end: { column: 15, line: 3 }, + }, -+ }, + }, + TemplateElement { + type: 'TemplateElement', + tail: true, @@ -116,7 +119,7 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-2 AST Alignmen + start: { column: 20, line: 3 }, + end: { column: 22, line: 3 }, + }, - }, ++ }, + ], + + range: [82, 95], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-3/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-3/snapshots/1-TSESTree-AST.shot index 4e5a39bfc46..7ee4abbefd5 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-3/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-3/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Color", + optional: false, range: [78, 83], loc: { @@ -76,9 +79,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Quantity", + optional: false, range: [107, 115], loc: { @@ -146,9 +152,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "SeussFish", + optional: false, range: [138, 147], loc: { @@ -196,7 +205,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Quantity", + optional: false, range: [153, 161], loc: { @@ -215,7 +226,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Color", + optional: false, range: [164, 169], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-3/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-3/snapshots/5-AST-Alignment-AST.shot index 948340c0664..9a373c60376 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-3/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-3/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-3 AST Alignmen body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Color', +- optional: false, range: [78, 83], loc: { @@ -80,9 +83,12 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-3 AST Alignmen }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Quantity', +- optional: false, range: [107, 115], loc: { @@ -150,9 +156,12 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-3 AST Alignmen }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'SeussFish', +- optional: false, range: [138, 147], loc: { @@ -170,6 +179,20 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-3 AST Alignmen - 'cooked': '', - 'raw': '', - }, +- +- range: [150, 153], +- loc: { +- start: { column: 17, line: 5 }, +- end: { column: 20, line: 5 }, +- }, +- }, +- TemplateElement { +- type: 'TemplateElement', +- tail: true, +- value: Object { +- 'cooked': ' fish', +- 'raw': ' fish', +- }, + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: TemplateLiteral { @@ -184,20 +207,6 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-3 AST Alignmen + type: 'Identifier', + name: 'Quantity', -- range: [150, 153], -- loc: { -- start: { column: 17, line: 5 }, -- end: { column: 20, line: 5 }, -- }, -- }, -- TemplateElement { -- type: 'TemplateElement', -- tail: true, -- value: Object { -- 'cooked': ' fish', -- 'raw': ' fish', -- }, -- - range: [169, 176], - loc: { - start: { column: 36, line: 5 }, @@ -213,7 +222,9 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-3 AST Alignmen - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'Quantity', +- optional: false, + range: [153, 161], + loc: { + start: { column: 20, line: 5 }, @@ -243,7 +254,9 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-3 AST Alignmen - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'Color', +- optional: false, + range: [164, 169], + loc: { + start: { column: 31, line: 5 }, diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/1-TSESTree-AST.shot index 6e8c437206f..caf85e02c19 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "EnthusiasticGreeting", + optional: false, range: [78, 98], loc: { @@ -100,7 +103,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [134, 135], loc: { @@ -125,7 +130,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Uppercase", + optional: false, range: [124, 133], loc: { @@ -140,7 +147,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [134, 135], loc: { @@ -179,7 +188,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [152, 153], loc: { @@ -204,7 +215,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Lowercase", + optional: false, range: [142, 151], loc: { @@ -219,7 +232,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [152, 153], loc: { @@ -258,7 +273,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [171, 172], loc: { @@ -283,7 +300,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Capitalize", + optional: false, range: [160, 170], loc: { @@ -298,7 +317,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [171, 172], loc: { @@ -337,7 +358,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [192, 193], loc: { @@ -362,7 +385,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "Uncapitalize", + optional: false, range: [179, 191], loc: { @@ -377,7 +402,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [192, 193], loc: { @@ -432,7 +459,9 @@ Program { in: false, name: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [99, 100], loc: { @@ -465,9 +494,12 @@ Program { }, TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "HELLO", + optional: false, range: [203, 208], loc: { @@ -510,7 +542,9 @@ Program { }, typeName: Identifier { type: "Identifier", + decorators: Array [], name: "EnthusiasticGreeting", + optional: false, range: [211, 231], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/5-AST-Alignment-AST.shot index 5819613357d..984e1b25eb7 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/template-literal-type-4/snapshots/5-AST-Alignment-AST.shot @@ -10,9 +10,12 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen body: Array [ TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'EnthusiasticGreeting', +- optional: false, range: [78, 98], loc: { @@ -54,6 +57,20 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - 'cooked': ' - ', - 'raw': ' - ', - }, +- +- range: [136, 142], +- loc: { +- start: { column: 17, line: 4 }, +- end: { column: 23, line: 4 }, +- }, +- }, +- TemplateElement { +- type: 'TemplateElement', +- tail: false, +- value: Object { +- 'cooked': ' - ', +- 'raw': ' - ', +- }, + range: [124, 133], + loc: { + start: { column: 5, line: 4 }, @@ -69,20 +86,6 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen + type: 'Identifier', + name: 'T', -- range: [136, 142], -- loc: { -- start: { column: 17, line: 4 }, -- end: { column: 23, line: 4 }, -- }, -- }, -- TemplateElement { -- type: 'TemplateElement', -- tail: false, -- value: Object { -- 'cooked': ' - ', -- 'raw': ' - ', -- }, -- - range: [154, 160], - loc: { - start: { column: 35, line: 4 }, @@ -134,7 +137,9 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - range: [134, 135], loc: { @@ -164,7 +169,9 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - }, - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'Uppercase', +- optional: false, - range: [124, 133], + range: [124, 136], @@ -181,20 +188,22 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', -- -- range: [134, 135], -- loc: { -- start: { column: 15, line: 4 }, -- end: { column: 16, line: 4 }, -- }, -- }, +- optional: false, + TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', + name: 'Lowercase', +- range: [134, 135], +- loc: { +- start: { column: 15, line: 4 }, +- end: { column: 16, line: 4 }, +- }, +- }, +- - range: [134, 135], - loc: { - start: { column: 15, line: 4 }, @@ -237,7 +246,9 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, + range: [152, 153], + loc: { + start: { column: 33, line: 4 }, @@ -273,7 +284,9 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - }, - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'Lowercase', +- optional: false, - range: [142, 151], + range: [142, 154], @@ -290,7 +303,9 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [152, 153], - loc: { @@ -346,7 +361,9 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, + range: [171, 172], + loc: { + start: { column: 52, line: 4 }, @@ -382,7 +399,9 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - }, - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'Capitalize', +- optional: false, - range: [160, 170], + range: [160, 173], @@ -399,20 +418,22 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', -- -- range: [171, 172], -- loc: { -- start: { column: 52, line: 4 }, -- end: { column: 53, line: 4 }, -- }, -- }, +- optional: false, + TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', + name: 'Uncapitalize', +- range: [171, 172], +- loc: { +- start: { column: 52, line: 4 }, +- end: { column: 53, line: 4 }, +- }, +- }, +- - range: [171, 172], - loc: { - start: { column: 52, line: 4 }, @@ -455,7 +476,9 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, + range: [192, 193], + loc: { + start: { column: 73, line: 4 }, @@ -494,7 +517,9 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen }, - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'Uncapitalize', +- optional: false, + ], + quasis: Array [ + TemplateElement { @@ -521,7 +546,9 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, + TemplateElement { + type: 'TemplateElement', + tail: false, @@ -631,7 +658,9 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - in: false, - name: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'T', +- optional: false, - - range: [99, 100], - loc: { @@ -665,9 +694,12 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen }, TSTypeAliasDeclaration { type: 'TSTypeAliasDeclaration', +- declare: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'HELLO', +- optional: false, range: [203, 208], loc: { @@ -710,7 +742,9 @@ exports[`AST Fixtures legacy-fixtures types template-literal-type-4 AST Alignmen - }, typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'EnthusiasticGreeting', +- optional: false, range: [211, 231], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/1-TSESTree-AST.shot index 59345cea548..b1883460703 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/1-TSESTree-AST.shot @@ -6,6 +6,7 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ @@ -14,9 +15,13 @@ Program { accessibility: "public", computed: false, declare: false, + decorators: Array [], + definite: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [92, 93], loc: { @@ -24,7 +29,9 @@ Program { end: { column: 10, line: 4 }, }, }, + optional: false, override: false, + readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", @@ -56,9 +63,12 @@ Program { type: "MethodDefinition", accessibility: "public", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "method", + optional: false, range: [113, 119], loc: { @@ -67,6 +77,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -92,7 +103,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [158, 159], loc: { @@ -122,13 +135,16 @@ Program { end: { column: 3, line: 8 }, }, }, + declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "this", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSThisType { @@ -191,9 +207,12 @@ Program { type: "MethodDefinition", accessibility: "public", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "method2", + optional: false, range: [175, 182], loc: { @@ -202,6 +221,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -227,7 +247,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [216, 217], loc: { @@ -257,20 +279,25 @@ Program { end: { column: 3, line: 12 }, }, }, + declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "this", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [189, 190], loc: { @@ -336,9 +363,12 @@ Program { type: "MethodDefinition", accessibility: "public", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "method3", + optional: false, range: [233, 240], loc: { @@ -347,6 +377,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -360,9 +391,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "fn", + optional: false, range: [271, 273], loc: { @@ -388,7 +422,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [287, 288], loc: { @@ -422,6 +458,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [267, 289], @@ -437,7 +474,9 @@ Program { arguments: Array [], callee: Identifier { type: "Identifier", + decorators: Array [], name: "fn", + optional: false, range: [301, 303], loc: { @@ -468,13 +507,16 @@ Program { end: { column: 3, line: 17 }, }, }, + declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "this", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSThisType { @@ -537,9 +579,12 @@ Program { type: "MethodDefinition", accessibility: "public", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "method4", + optional: false, range: [321, 328], loc: { @@ -548,6 +593,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -561,9 +607,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "fn", + optional: false, range: [356, 358], loc: { @@ -589,7 +638,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [372, 373], loc: { @@ -623,6 +674,7 @@ Program { }, }, ], + declare: false, kind: "var", range: [352, 374], @@ -638,7 +690,9 @@ Program { arguments: Array [], callee: Identifier { type: "Identifier", + decorators: Array [], name: "fn", + optional: false, range: [386, 388], loc: { @@ -669,20 +723,25 @@ Program { end: { column: 3, line: 22 }, }, }, + declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "this", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [335, 336], loc: { @@ -747,9 +806,12 @@ Program { MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "staticMethod", + optional: false, range: [406, 418], loc: { @@ -758,6 +820,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: true, value: FunctionExpression { @@ -783,7 +846,9 @@ Program { optional: false, property: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [454, 455], loc: { @@ -813,20 +878,25 @@ Program { end: { column: 3, line: 26 }, }, }, + declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "this", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [425, 426], loc: { @@ -891,9 +961,12 @@ Program { MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "typeof", + optional: false, range: [471, 477], loc: { @@ -902,6 +975,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: true, value: FunctionExpression { @@ -947,20 +1021,25 @@ Program { end: { column: 3, line: 30 }, }, }, + declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: "Identifier", + decorators: Array [], name: "this", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeReference { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [484, 485], loc: { @@ -1030,9 +1109,13 @@ Program { end: { column: 1, line: 31 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "A", + optional: false, range: [79, 80], loc: { @@ -1040,6 +1123,7 @@ Program { end: { column: 7, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 524], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/5-AST-Alignment-AST.shot index 11f2406bcb5..9e0dd132e21 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type-expanded/snapshots/5-AST-Alignment-AST.shot @@ -10,6 +10,7 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ @@ -18,9 +19,13 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A accessibility: 'public', computed: false, - declare: false, +- decorators: Array [], +- definite: false, key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [92, 93], loc: { @@ -28,7 +33,9 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A end: { column: 10, line: 4 }, }, }, +- optional: false, - override: false, +- readonly: false, static: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', @@ -60,9 +67,12 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A type: 'MethodDefinition', accessibility: 'public', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'method', +- optional: false, range: [113, 119], loc: { @@ -71,6 +81,7 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -96,7 +107,9 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [158, 159], loc: { @@ -126,13 +139,16 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A end: { column: 3, line: 8 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'this', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSThisType { @@ -195,9 +211,12 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A type: 'MethodDefinition', accessibility: 'public', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'method2', +- optional: false, range: [175, 182], loc: { @@ -206,6 +225,7 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -231,7 +251,9 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [216, 217], loc: { @@ -261,20 +283,25 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A end: { column: 3, line: 12 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'this', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [189, 190], loc: { @@ -340,9 +367,12 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A type: 'MethodDefinition', accessibility: 'public', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'method3', +- optional: false, range: [233, 240], loc: { @@ -351,6 +381,7 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -364,9 +395,12 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'fn', +- optional: false, range: [271, 273], loc: { @@ -392,7 +426,9 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [287, 288], loc: { @@ -426,6 +462,7 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A }, }, ], +- declare: false, kind: 'var', range: [267, 289], @@ -441,7 +478,9 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A arguments: Array [], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'fn', +- optional: false, range: [301, 303], loc: { @@ -472,13 +511,16 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A end: { column: 3, line: 17 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'this', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSThisType { @@ -541,9 +583,12 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A type: 'MethodDefinition', accessibility: 'public', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'method4', +- optional: false, range: [321, 328], loc: { @@ -552,6 +597,7 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -565,9 +611,12 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'fn', +- optional: false, range: [356, 358], loc: { @@ -593,7 +642,9 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [372, 373], loc: { @@ -627,6 +678,7 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A }, }, ], +- declare: false, kind: 'var', range: [352, 374], @@ -642,7 +694,9 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A arguments: Array [], callee: Identifier { type: 'Identifier', +- decorators: Array [], name: 'fn', +- optional: false, range: [386, 388], loc: { @@ -673,20 +727,25 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A end: { column: 3, line: 22 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'this', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [335, 336], loc: { @@ -751,9 +810,12 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'staticMethod', +- optional: false, range: [406, 418], loc: { @@ -762,6 +824,7 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: true, value: FunctionExpression { @@ -787,7 +850,9 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A optional: false, property: Identifier { type: 'Identifier', +- decorators: Array [], name: 'a', +- optional: false, range: [454, 455], loc: { @@ -817,20 +882,25 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A end: { column: 3, line: 26 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'this', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [425, 426], loc: { @@ -895,9 +965,12 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'typeof', +- optional: false, range: [471, 477], loc: { @@ -906,6 +979,7 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A }, }, kind: 'method', +- optional: false, - override: false, static: true, value: FunctionExpression { @@ -951,20 +1025,25 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A end: { column: 3, line: 30 }, }, }, +- declare: false, expression: false, generator: false, id: null, params: Array [ Identifier { type: 'Identifier', +- decorators: Array [], name: 'this', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeReference { type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [484, 485], loc: { @@ -1034,9 +1113,13 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A end: { column: 1, line: 31 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'A', +- optional: false, range: [79, 80], loc: { @@ -1044,6 +1127,7 @@ exports[`AST Fixtures legacy-fixtures types this-type-expanded AST Alignment - A end: { column: 7, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 524], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type/snapshots/1-TSESTree-AST.shot index 6390741cd31..645b977c622 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type/snapshots/1-TSESTree-AST.shot @@ -6,15 +6,19 @@ Program { body: Array [ ClassDeclaration { type: "ClassDeclaration", + abstract: false, body: ClassBody { type: "ClassBody", body: Array [ MethodDefinition { type: "MethodDefinition", computed: false, + decorators: Array [], key: Identifier { type: "Identifier", + decorators: Array [], name: "clone", + optional: false, range: [91, 96], loc: { @@ -23,6 +27,7 @@ Program { }, }, kind: "method", + optional: false, override: false, static: false, value: FunctionExpression { @@ -57,6 +62,7 @@ Program { end: { column: 3, line: 6 }, }, }, + declare: false, expression: false, generator: false, id: null, @@ -101,9 +107,13 @@ Program { end: { column: 1, line: 7 }, }, }, + declare: false, + decorators: Array [], id: Identifier { type: "Identifier", + decorators: Array [], name: "Message", + optional: false, range: [79, 86], loc: { @@ -111,6 +121,7 @@ Program { end: { column: 13, line: 3 }, }, }, + implements: Array [], superClass: null, range: [73, 129], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type/snapshots/5-AST-Alignment-AST.shot index f4e9993acae..2f079c26764 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/this-type/snapshots/5-AST-Alignment-AST.shot @@ -10,15 +10,19 @@ exports[`AST Fixtures legacy-fixtures types this-type AST Alignment - AST 1`] = body: Array [ ClassDeclaration { type: 'ClassDeclaration', +- abstract: false, body: ClassBody { type: 'ClassBody', body: Array [ MethodDefinition { type: 'MethodDefinition', computed: false, +- decorators: Array [], key: Identifier { type: 'Identifier', +- decorators: Array [], name: 'clone', +- optional: false, range: [91, 96], loc: { @@ -27,6 +31,7 @@ exports[`AST Fixtures legacy-fixtures types this-type AST Alignment - AST 1`] = }, }, kind: 'method', +- optional: false, - override: false, static: false, value: FunctionExpression { @@ -61,6 +66,7 @@ exports[`AST Fixtures legacy-fixtures types this-type AST Alignment - AST 1`] = end: { column: 3, line: 6 }, }, }, +- declare: false, expression: false, generator: false, id: null, @@ -105,9 +111,13 @@ exports[`AST Fixtures legacy-fixtures types this-type AST Alignment - AST 1`] = end: { column: 1, line: 7 }, }, }, +- declare: false, +- decorators: Array [], id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'Message', +- optional: false, range: [79, 86], loc: { @@ -115,6 +125,7 @@ exports[`AST Fixtures legacy-fixtures types this-type AST Alignment - AST 1`] = end: { column: 13, line: 3 }, }, }, +- implements: Array [], superClass: null, range: [73, 129], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-empty/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-empty/snapshots/1-TSESTree-AST.shot index be5220d25e3..30bc918a263 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-empty/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-empty/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTupleType { @@ -47,6 +50,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 83], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-empty/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-empty/snapshots/5-AST-Alignment-AST.shot index f467aab6aae..93ce1725a9e 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-empty/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-empty/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,74 @@ exports[`AST Fixtures legacy-fixtures types tuple-empty AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTupleType { + type: 'TSTupleType', + elementTypes: Array [], + + range: [80, 82], + loc: { + start: { column: 7, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + + range: [78, 82], + loc: { + start: { column: 5, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + + range: [77, 82], + loc: { + start: { column: 4, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + init: null, + + range: [77, 82], + loc: { + start: { column: 4, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 83], + loc: { + start: { column: 0, line: 3 }, + end: { column: 10, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 84], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-optional/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-optional/snapshots/1-TSESTree-AST.shot index 5e1f88bf575..09434fd1d61 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-optional/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-optional/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTupleType { @@ -30,7 +33,9 @@ Program { }, label: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [81, 82], loc: { @@ -59,7 +64,9 @@ Program { }, label: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [92, 93], loc: { @@ -108,7 +115,9 @@ Program { }, label: Identifier { type: "Identifier", + decorators: Array [], name: "c", + optional: false, range: [104, 105], loc: { @@ -155,6 +164,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 125], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-optional/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-optional/snapshots/5-AST-Alignment-AST.shot index 487dca4144b..cf045fd04e4 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-optional/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-optional/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,188 @@ exports[`AST Fixtures legacy-fixtures types tuple-named-optional AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTupleType { + type: 'TSTupleType', + elementTypes: Array [ + TSNamedTupleMember { + type: 'TSNamedTupleMember', + elementType: TSStringKeyword { + type: 'TSStringKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + label: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [81, 82], + loc: { + start: { column: 8, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + optional: false, + + range: [81, 90], + loc: { + start: { column: 8, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + TSNamedTupleMember { + type: 'TSNamedTupleMember', + elementType: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [96, 102], + loc: { + start: { column: 23, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + label: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [92, 93], + loc: { + start: { column: 19, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + optional: true, + + range: [92, 102], + loc: { + start: { column: 19, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + TSNamedTupleMember { + type: 'TSNamedTupleMember', + elementType: TSUnionType { + type: 'TSUnionType', + types: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [108, 114], + loc: { + start: { column: 35, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [117, 123], + loc: { + start: { column: 44, line: 3 }, + end: { column: 50, line: 3 }, + }, + }, + ], + + range: [108, 123], + loc: { + start: { column: 35, line: 3 }, + end: { column: 50, line: 3 }, + }, + }, + label: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'c', +- optional: false, + + range: [104, 105], + loc: { + start: { column: 31, line: 3 }, + end: { column: 32, line: 3 }, + }, + }, + optional: true, + + range: [104, 123], + loc: { + start: { column: 31, line: 3 }, + end: { column: 50, line: 3 }, + }, + }, + ], + + range: [80, 124], + loc: { + start: { column: 7, line: 3 }, + end: { column: 51, line: 3 }, + }, + }, + + range: [78, 124], + loc: { + start: { column: 5, line: 3 }, + end: { column: 51, line: 3 }, + }, + }, + + range: [77, 124], + loc: { + start: { column: 4, line: 3 }, + end: { column: 51, line: 3 }, + }, + }, + init: null, + + range: [77, 124], + loc: { + start: { column: 4, line: 3 }, + end: { column: 51, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 125], + loc: { + start: { column: 0, line: 3 }, + end: { column: 52, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 126], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-rest/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-rest/snapshots/1-TSESTree-AST.shot index 3f033ff3b4a..b6780723ff5 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-rest/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-rest/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTupleType { @@ -30,7 +33,9 @@ Program { }, label: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [81, 82], loc: { @@ -70,7 +75,9 @@ Program { }, label: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [95, 96], loc: { @@ -124,6 +131,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 108], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-rest/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-rest/snapshots/5-AST-Alignment-AST.shot index 4355a551b82..c7398b84a5b 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-rest/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-rest/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,155 @@ exports[`AST Fixtures legacy-fixtures types tuple-named-rest AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTupleType { + type: 'TSTupleType', + elementTypes: Array [ + TSNamedTupleMember { + type: 'TSNamedTupleMember', + elementType: TSStringKeyword { + type: 'TSStringKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + label: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [81, 82], + loc: { + start: { column: 8, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + optional: false, + + range: [81, 90], + loc: { + start: { column: 8, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + TSRestType { + type: 'TSRestType', + typeAnnotation: TSNamedTupleMember { + type: 'TSNamedTupleMember', + elementType: TSArrayType { + type: 'TSArrayType', + elementType: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [98, 104], + loc: { + start: { column: 25, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + + range: [98, 106], + loc: { + start: { column: 25, line: 3 }, + end: { column: 33, line: 3 }, + }, + }, + label: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [95, 96], + loc: { + start: { column: 22, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + optional: false, + + range: [95, 106], + loc: { + start: { column: 22, line: 3 }, + end: { column: 33, line: 3 }, + }, + }, + + range: [92, 106], + loc: { + start: { column: 19, line: 3 }, + end: { column: 33, line: 3 }, + }, + }, + ], + + range: [80, 107], + loc: { + start: { column: 7, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [78, 107], + loc: { + start: { column: 5, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [77, 107], + loc: { + start: { column: 4, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + init: null, + + range: [77, 107], + loc: { + start: { column: 4, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 108], + loc: { + start: { column: 0, line: 3 }, + end: { column: 35, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 109], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-type/snapshots/1-TSESTree-AST.shot index cea3a5527f0..6eb6768dfd8 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-type/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [78, 81], loc: { @@ -32,7 +35,9 @@ Program { }, label: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [85, 86], loc: { @@ -61,7 +66,9 @@ Program { }, label: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [96, 97], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-type/snapshots/5-AST-Alignment-AST.shot index 8767560841d..44ce3bf0db0 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,114 @@ exports[`AST Fixtures legacy-fixtures types tuple-named-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSTupleType { + type: 'TSTupleType', + elementTypes: Array [ + TSNamedTupleMember { + type: 'TSNamedTupleMember', + elementType: TSStringKeyword { + type: 'TSStringKeyword', + + range: [88, 94], + loc: { + start: { column: 15, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + label: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [85, 86], + loc: { + start: { column: 12, line: 3 }, + end: { column: 13, line: 3 }, + }, + }, + optional: false, + + range: [85, 94], + loc: { + start: { column: 12, line: 3 }, + end: { column: 21, line: 3 }, + }, + }, + TSNamedTupleMember { + type: 'TSNamedTupleMember', + elementType: TSStringKeyword { + type: 'TSStringKeyword', + + range: [100, 106], + loc: { + start: { column: 27, line: 3 }, + end: { column: 33, line: 3 }, + }, + }, + label: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [96, 97], + loc: { + start: { column: 23, line: 3 }, + end: { column: 24, line: 3 }, + }, + }, + optional: true, + + range: [96, 106], + loc: { + start: { column: 23, line: 3 }, + end: { column: 33, line: 3 }, + }, + }, + ], + + range: [84, 107], + loc: { + start: { column: 11, line: 3 }, + end: { column: 34, line: 3 }, + }, + }, + + range: [73, 108], + loc: { + start: { column: 0, line: 3 }, + end: { column: 35, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 109], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named/snapshots/1-TSESTree-AST.shot index 733eacf0a27..f929b4bb096 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTupleType { @@ -30,7 +33,9 @@ Program { }, label: Identifier { type: "Identifier", + decorators: Array [], name: "a", + optional: false, range: [81, 82], loc: { @@ -59,7 +64,9 @@ Program { }, label: Identifier { type: "Identifier", + decorators: Array [], name: "b", + optional: false, range: [92, 93], loc: { @@ -88,7 +95,9 @@ Program { }, label: Identifier { type: "Identifier", + decorators: Array [], name: "c", + optional: false, range: [103, 104], loc: { @@ -135,6 +144,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 114], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named/snapshots/5-AST-Alignment-AST.shot index 99fb9783e7c..46056560b92 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-named/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,168 @@ exports[`AST Fixtures legacy-fixtures types tuple-named AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTupleType { + type: 'TSTupleType', + elementTypes: Array [ + TSNamedTupleMember { + type: 'TSNamedTupleMember', + elementType: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + label: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'a', +- optional: false, + + range: [81, 82], + loc: { + start: { column: 8, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + optional: false, + + range: [81, 90], + loc: { + start: { column: 8, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + TSNamedTupleMember { + type: 'TSNamedTupleMember', + elementType: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [95, 101], + loc: { + start: { column: 22, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + label: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'b', +- optional: false, + + range: [92, 93], + loc: { + start: { column: 19, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + optional: false, + + range: [92, 101], + loc: { + start: { column: 19, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + TSNamedTupleMember { + type: 'TSNamedTupleMember', + elementType: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [106, 112], + loc: { + start: { column: 33, line: 3 }, + end: { column: 39, line: 3 }, + }, + }, + label: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'c', +- optional: false, + + range: [103, 104], + loc: { + start: { column: 30, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + optional: false, + + range: [103, 112], + loc: { + start: { column: 30, line: 3 }, + end: { column: 39, line: 3 }, + }, + }, + ], + + range: [80, 113], + loc: { + start: { column: 7, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + + range: [78, 113], + loc: { + start: { column: 5, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + + range: [77, 113], + loc: { + start: { column: 4, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + init: null, + + range: [77, 113], + loc: { + start: { column: 4, line: 3 }, + end: { column: 40, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 114], + loc: { + start: { column: 0, line: 3 }, + end: { column: 41, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 115], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-optional/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-optional/snapshots/1-TSESTree-AST.shot index 5036e8cb637..e33da0f4fe8 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-optional/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-optional/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTupleType { @@ -113,6 +116,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-optional/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-optional/snapshots/5-AST-Alignment-AST.shot index 92d042d52fb..c18e7df81ac 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-optional/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-optional/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types tuple-optional AST Alignment - AST 1 declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTupleType { @@ -146,6 +149,7 @@ exports[`AST Fixtures legacy-fixtures types tuple-optional AST Alignment - AST 1 }, }, ], +- declare: false, kind: 'let', range: [73, 118], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-rest/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-rest/snapshots/1-TSESTree-AST.shot index 3577cb828c0..024fc757070 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-rest/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-rest/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTupleType { @@ -84,6 +87,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 102], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-rest/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-rest/snapshots/5-AST-Alignment-AST.shot index f5b3150c2e7..39b744ef4e5 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-rest/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-rest/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,111 @@ exports[`AST Fixtures legacy-fixtures types tuple-rest AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTupleType { + type: 'TSTupleType', + elementTypes: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [81, 87], + loc: { + start: { column: 8, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + TSRestType { + type: 'TSRestType', + typeAnnotation: TSArrayType { + type: 'TSArrayType', + elementType: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [92, 98], + loc: { + start: { column: 19, line: 3 }, + end: { column: 25, line: 3 }, + }, + }, + + range: [92, 100], + loc: { + start: { column: 19, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + + range: [89, 100], + loc: { + start: { column: 16, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + ], + + range: [80, 101], + loc: { + start: { column: 7, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + + range: [78, 101], + loc: { + start: { column: 5, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + + range: [77, 101], + loc: { + start: { column: 4, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + init: null, + + range: [77, 101], + loc: { + start: { column: 4, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 102], + loc: { + start: { column: 0, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 103], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-type/snapshots/1-TSESTree-AST.shot index 5349bd45b02..bf960496865 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-type/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-type/snapshots/5-AST-Alignment-AST.shot index 861edac4e34..c6091651029 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,79 @@ exports[`AST Fixtures legacy-fixtures types tuple-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSTupleType { + type: 'TSTupleType', + elementTypes: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [85, 91], + loc: { + start: { column: 12, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + TSOptionalType { + type: 'TSOptionalType', + typeAnnotation: TSStringKeyword { + type: 'TSStringKeyword', + + range: [93, 99], + loc: { + start: { column: 20, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + + range: [93, 100], + loc: { + start: { column: 20, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + ], + + range: [84, 101], + loc: { + start: { column: 11, line: 3 }, + end: { column: 28, line: 3 }, + }, + }, + + range: [73, 102], + loc: { + start: { column: 0, line: 3 }, + end: { column: 29, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 103], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple/snapshots/1-TSESTree-AST.shot index 674810200f7..dd13561d828 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTupleType { @@ -75,6 +78,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 105], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple/snapshots/5-AST-Alignment-AST.shot index 9daf8bf8637..17d1d9f4695 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/tuple/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,102 @@ exports[`AST Fixtures legacy-fixtures types tuple AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTupleType { + type: 'TSTupleType', + elementTypes: Array [ + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [81, 87], + loc: { + start: { column: 8, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [89, 95], + loc: { + start: { column: 16, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [97, 103], + loc: { + start: { column: 24, line: 3 }, + end: { column: 30, line: 3 }, + }, + }, + ], + + range: [80, 104], + loc: { + start: { column: 7, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + + range: [78, 104], + loc: { + start: { column: 5, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + + range: [77, 104], + loc: { + start: { column: 4, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + init: null, + + range: [77, 104], + loc: { + start: { column: 4, line: 3 }, + end: { column: 31, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 105], + loc: { + start: { column: 0, line: 3 }, + end: { column: 32, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 106], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-literal/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-literal/snapshots/1-TSESTree-AST.shot index 9b45172d796..3c720cd4f30 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-literal/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-literal/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "obj", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeLiteral { @@ -22,7 +25,9 @@ Program { computed: false, key: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, range: [84, 85], loc: { @@ -30,6 +35,9 @@ Program { end: { column: 12, line: 3 }, }, }, + optional: false, + readonly: false, + static: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSNumberKeyword { @@ -86,6 +94,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 96], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-literal/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-literal/snapshots/5-AST-Alignment-AST.shot index f7e7f886601..66cd9e9abe8 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-literal/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-literal/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,118 @@ exports[`AST Fixtures legacy-fixtures types type-literal AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'obj', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeLiteral { + type: 'TSTypeLiteral', + members: Array [ + TSPropertySignature { + type: 'TSPropertySignature', + computed: false, + key: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + + range: [84, 85], + loc: { + start: { column: 11, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, +- optional: false, +- readonly: false, +- static: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [87, 93], + loc: { + start: { column: 14, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [85, 93], + loc: { + start: { column: 12, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + + range: [84, 93], + loc: { + start: { column: 11, line: 3 }, + end: { column: 20, line: 3 }, + }, + }, + ], + + range: [82, 95], + loc: { + start: { column: 9, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + + range: [80, 95], + loc: { + start: { column: 7, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + + range: [77, 95], + loc: { + start: { column: 4, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + init: null, + + range: [77, 95], + loc: { + start: { column: 4, line: 3 }, + end: { column: 22, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 96], + loc: { + start: { column: 0, line: 3 }, + end: { column: 23, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 97], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-operator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-operator/snapshots/1-TSESTree-AST.shot index 66c567c2304..2b6394f5fb7 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-operator/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-operator/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeOperator { @@ -21,7 +24,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "T", + optional: false, range: [86, 87], loc: { @@ -66,6 +71,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 88], @@ -79,9 +85,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "y", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeOperator { @@ -126,6 +135,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [89, 110], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-operator/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-operator/snapshots/5-AST-Alignment-AST.shot index ae11f119f07..1cc236c53e0 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-operator/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/type-operator/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,159 @@ exports[`AST Fixtures legacy-fixtures types type-operator AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeOperator { + type: 'TSTypeOperator', + operator: 'keyof', + typeAnnotation: TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'T', +- optional: false, + + range: [86, 87], + loc: { + start: { column: 13, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [86, 87], + loc: { + start: { column: 13, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [80, 87], + loc: { + start: { column: 7, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [78, 87], + loc: { + start: { column: 5, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + + range: [77, 87], + loc: { + start: { column: 4, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + init: null, + + range: [77, 87], + loc: { + start: { column: 4, line: 3 }, + end: { column: 14, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 88], + loc: { + start: { column: 0, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'y', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeOperator { + type: 'TSTypeOperator', + operator: 'unique', + typeAnnotation: TSSymbolKeyword { + type: 'TSSymbolKeyword', + + range: [103, 109], + loc: { + start: { column: 14, line: 4 }, + end: { column: 20, line: 4 }, + }, + }, + + range: [96, 109], + loc: { + start: { column: 7, line: 4 }, + end: { column: 20, line: 4 }, + }, + }, + + range: [94, 109], + loc: { + start: { column: 5, line: 4 }, + end: { column: 20, line: 4 }, + }, + }, + + range: [93, 109], + loc: { + start: { column: 4, line: 4 }, + end: { column: 20, line: 4 }, + }, + }, + init: null, + + range: [93, 109], + loc: { + start: { column: 4, line: 4 }, + end: { column: 20, line: 4 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [89, 110], + loc: { + start: { column: 0, line: 4 }, + end: { column: 21, line: 4 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 111], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 5 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/1-TSESTree-AST.shot index 7a8b4111b0d..1deaaf90816 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "self", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeQuery { @@ -55,6 +58,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 95], @@ -68,9 +72,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeQuery { @@ -88,7 +95,9 @@ Program { }, right: Identifier { type: "Identifier", + decorators: Array [], name: "foo", + optional: false, range: [117, 120], loc: { @@ -133,6 +142,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [96, 121], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/5-AST-Alignment-AST.shot index 742698e35d8..e032e84b0c5 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-this/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types typeof-this AST Alignment - AST 1`] declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'self', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeQuery { @@ -62,6 +65,7 @@ exports[`AST Fixtures legacy-fixtures types typeof-this AST Alignment - AST 1`] }, }, ], +- declare: false, kind: 'let', range: [73, 95], @@ -75,9 +79,12 @@ exports[`AST Fixtures legacy-fixtures types typeof-this AST Alignment - AST 1`] declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeQuery { @@ -98,7 +105,9 @@ exports[`AST Fixtures legacy-fixtures types typeof-this AST Alignment - AST 1`] }, right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'foo', +- optional: false, range: [117, 120], loc: { @@ -143,6 +152,7 @@ exports[`AST Fixtures legacy-fixtures types typeof-this AST Alignment - AST 1`] }, }, ], +- declare: false, kind: 'let', range: [96, 121], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/1-TSESTree-AST.shot index 7b655eafbec..4fe7efef243 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeQuery { @@ -20,7 +23,9 @@ Program { type: "TSQualifiedName", left: Identifier { type: "Identifier", + decorators: Array [], name: "y", + optional: false, range: [87, 88], loc: { @@ -30,7 +35,9 @@ Program { }, right: Identifier { type: "Identifier", + decorators: Array [], name: "z", + optional: false, range: [89, 90], loc: { @@ -52,7 +59,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "w", + optional: false, range: [91, 92], loc: { @@ -82,7 +91,9 @@ Program { type: "TSTypeReference", typeName: Identifier { type: "Identifier", + decorators: Array [], name: "w", + optional: false, range: [91, 92], loc: { @@ -135,6 +146,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 94], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/5-AST-Alignment-AST.shot index a194ac6f2e6..47c46716aab 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof-with-type-parameters/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types typeof-with-type-parameters AST Alig declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'x', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSTypeQuery { @@ -24,7 +27,9 @@ exports[`AST Fixtures legacy-fixtures types typeof-with-type-parameters AST Alig type: 'TSQualifiedName', left: Identifier { type: 'Identifier', +- decorators: Array [], name: 'y', +- optional: false, range: [87, 88], loc: { @@ -34,7 +39,9 @@ exports[`AST Fixtures legacy-fixtures types typeof-with-type-parameters AST Alig }, right: Identifier { type: 'Identifier', +- decorators: Array [], name: 'z', +- optional: false, range: [89, 90], loc: { @@ -47,8 +54,8 @@ exports[`AST Fixtures legacy-fixtures types typeof-with-type-parameters AST Alig loc: { start: { column: 14, line: 3 }, end: { column: 17, line: 3 }, - }, - }, +- }, +- }, - typeArguments: TSTypeParameterInstantiation { - type: 'TSTypeParameterInstantiation', - params: Array [ @@ -56,7 +63,9 @@ exports[`AST Fixtures legacy-fixtures types typeof-with-type-parameters AST Alig - type: 'TSTypeReference', - typeName: Identifier { - type: 'Identifier', +- decorators: Array [], - name: 'w', +- optional: false, - - range: [91, 92], - loc: { @@ -77,8 +86,8 @@ exports[`AST Fixtures legacy-fixtures types typeof-with-type-parameters AST Alig - loc: { - start: { column: 17, line: 3 }, - end: { column: 20, line: 3 }, -- }, -- }, + }, + }, typeParameters: TSTypeParameterInstantiation { type: 'TSTypeParameterInstantiation', params: Array [ @@ -86,7 +95,9 @@ exports[`AST Fixtures legacy-fixtures types typeof-with-type-parameters AST Alig type: 'TSTypeReference', typeName: Identifier { type: 'Identifier', +- decorators: Array [], name: 'w', +- optional: false, range: [91, 92], loc: { @@ -139,6 +150,7 @@ exports[`AST Fixtures legacy-fixtures types typeof-with-type-parameters AST Alig }, }, ], +- declare: false, kind: 'let', range: [73, 94], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof/snapshots/1-TSESTree-AST.shot index 94086e9e321..12169047c0f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "x", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSTypeQuery { @@ -20,7 +23,9 @@ Program { type: "TSQualifiedName", left: Identifier { type: "Identifier", + decorators: Array [], name: "y", + optional: false, range: [87, 88], loc: { @@ -30,7 +35,9 @@ Program { }, right: Identifier { type: "Identifier", + decorators: Array [], name: "z", + optional: false, range: [89, 90], loc: { @@ -75,6 +82,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 91], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof/snapshots/5-AST-Alignment-AST.shot index 27f2e96b44e..9626fdabc89 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/typeof/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,106 @@ exports[`AST Fixtures legacy-fixtures types typeof AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + VariableDeclaration { + type: 'VariableDeclaration', + declarations: Array [ + VariableDeclarator { + type: 'VariableDeclarator', +- definite: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'x', +- optional: false, + typeAnnotation: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSTypeQuery { + type: 'TSTypeQuery', + exprName: TSQualifiedName { + type: 'TSQualifiedName', + left: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'y', +- optional: false, + + range: [87, 88], + loc: { + start: { column: 14, line: 3 }, + end: { column: 15, line: 3 }, + }, + }, + right: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'z', +- optional: false, + + range: [89, 90], + loc: { + start: { column: 16, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [87, 90], + loc: { + start: { column: 14, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [80, 90], + loc: { + start: { column: 7, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [78, 90], + loc: { + start: { column: 5, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + + range: [77, 90], + loc: { + start: { column: 4, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + init: null, + + range: [77, 90], + loc: { + start: { column: 4, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + ], +- declare: false, + kind: 'let', + + range: [73, 91], + loc: { + start: { column: 0, line: 3 }, + end: { column: 18, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 92], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/1-TSESTree-AST.shot index 22265118d1f..f5dfdf20d7f 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/1-TSESTree-AST.shot @@ -9,9 +9,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "union", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnionType { @@ -75,6 +78,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [73, 110], @@ -88,9 +92,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "intersection", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSIntersectionType { @@ -145,6 +152,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [111, 145], @@ -158,9 +166,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "precedence1", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnionType { @@ -235,6 +246,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [146, 191], @@ -248,9 +260,12 @@ Program { declarations: Array [ VariableDeclarator { type: "VariableDeclarator", + definite: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "precedence2", + optional: false, typeAnnotation: TSTypeAnnotation { type: "TSTypeAnnotation", typeAnnotation: TSUnionType { @@ -325,6 +340,7 @@ Program { }, }, ], + declare: false, kind: "let", range: [192, 237], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/5-AST-Alignment-AST.shot index ab9ae31400d..f06a5479ddf 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-intersection/snapshots/5-AST-Alignment-AST.shot @@ -13,9 +13,12 @@ exports[`AST Fixtures legacy-fixtures types union-intersection AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'union', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSUnionType { @@ -79,6 +82,7 @@ exports[`AST Fixtures legacy-fixtures types union-intersection AST Alignment - A }, }, ], +- declare: false, kind: 'let', range: [73, 110], @@ -92,9 +96,12 @@ exports[`AST Fixtures legacy-fixtures types union-intersection AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'intersection', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSIntersectionType { @@ -149,6 +156,7 @@ exports[`AST Fixtures legacy-fixtures types union-intersection AST Alignment - A }, }, ], +- declare: false, kind: 'let', range: [111, 145], @@ -162,9 +170,12 @@ exports[`AST Fixtures legacy-fixtures types union-intersection AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'precedence1', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSUnionType { @@ -268,6 +279,7 @@ exports[`AST Fixtures legacy-fixtures types union-intersection AST Alignment - A }, }, ], +- declare: false, kind: 'let', range: [146, 191], @@ -281,9 +293,12 @@ exports[`AST Fixtures legacy-fixtures types union-intersection AST Alignment - A declarations: Array [ VariableDeclarator { type: 'VariableDeclarator', +- definite: false, id: Identifier { type: 'Identifier', +- decorators: Array [], name: 'precedence2', +- optional: false, typeAnnotation: TSTypeAnnotation { type: 'TSTypeAnnotation', typeAnnotation: TSUnionType { @@ -387,6 +402,7 @@ exports[`AST Fixtures legacy-fixtures types union-intersection AST Alignment - A }, }, ], +- declare: false, kind: 'let', range: [192, 237], diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-type/snapshots/1-TSESTree-AST.shot index e96cd3e6674..5b757cf11f2 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-type/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-type/snapshots/1-TSESTree-AST.shot @@ -6,9 +6,12 @@ Program { body: Array [ TSTypeAliasDeclaration { type: "TSTypeAliasDeclaration", + declare: false, id: Identifier { type: "Identifier", + decorators: Array [], name: "Foo", + optional: false, range: [78, 81], loc: { diff --git a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-type/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-type/snapshots/5-AST-Alignment-AST.shot index 9bf8457567f..2a439c04296 100644 --- a/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-type/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/legacy-fixtures/types/fixtures/union-type/snapshots/5-AST-Alignment-AST.shot @@ -2,5 +2,70 @@ exports[`AST Fixtures legacy-fixtures types union-type AST Alignment - AST 1`] = ` "Snapshot Diff: -Compared values have no visual difference." +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', +- declare: false, + id: Identifier { + type: 'Identifier', +- decorators: Array [], + name: 'Foo', +- optional: false, + + range: [78, 81], + loc: { + start: { column: 5, line: 3 }, + end: { column: 8, line: 3 }, + }, + }, + typeAnnotation: TSIntersectionType { + type: 'TSIntersectionType', + types: Array [ + TSStringKeyword { + type: 'TSStringKeyword', + + range: [84, 90], + loc: { + start: { column: 11, line: 3 }, + end: { column: 17, line: 3 }, + }, + }, + TSNumberKeyword { + type: 'TSNumberKeyword', + + range: [93, 99], + loc: { + start: { column: 20, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + ], + + range: [84, 99], + loc: { + start: { column: 11, line: 3 }, + end: { column: 26, line: 3 }, + }, + }, + + range: [73, 100], + loc: { + start: { column: 0, line: 3 }, + end: { column: 27, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [73, 101], + loc: { + start: { column: 0, line: 3 }, + end: { column: 0, line: 4 }, + }, + }" `; diff --git a/packages/ast-spec/src/parameter/ArrayPattern/spec.ts b/packages/ast-spec/src/parameter/ArrayPattern/spec.ts index 420a9327873..9fd684b8044 100644 --- a/packages/ast-spec/src/parameter/ArrayPattern/spec.ts +++ b/packages/ast-spec/src/parameter/ArrayPattern/spec.ts @@ -7,7 +7,7 @@ import type { DestructuringPattern } from '../../unions/DestructuringPattern'; export interface ArrayPattern extends BaseNode { type: AST_NODE_TYPES.ArrayPattern; elements: (DestructuringPattern | null)[]; - typeAnnotation?: TSTypeAnnotation; - optional?: boolean; - decorators?: Decorator[]; + typeAnnotation: TSTypeAnnotation | undefined; + optional: boolean; + decorators: Decorator[]; } diff --git a/packages/ast-spec/src/parameter/AssignmentPattern/spec.ts b/packages/ast-spec/src/parameter/AssignmentPattern/spec.ts index ee558c2167c..208a44e8298 100644 --- a/packages/ast-spec/src/parameter/AssignmentPattern/spec.ts +++ b/packages/ast-spec/src/parameter/AssignmentPattern/spec.ts @@ -9,7 +9,7 @@ export interface AssignmentPattern extends BaseNode { type: AST_NODE_TYPES.AssignmentPattern; left: BindingName; right: Expression; - typeAnnotation?: TSTypeAnnotation; - optional?: boolean; - decorators?: Decorator[]; + typeAnnotation: TSTypeAnnotation | undefined; + optional: boolean; + decorators: Decorator[]; } diff --git a/packages/ast-spec/src/parameter/ObjectPattern/spec.ts b/packages/ast-spec/src/parameter/ObjectPattern/spec.ts index 12c89878794..76c53798a4d 100644 --- a/packages/ast-spec/src/parameter/ObjectPattern/spec.ts +++ b/packages/ast-spec/src/parameter/ObjectPattern/spec.ts @@ -8,7 +8,7 @@ import type { RestElement } from '../RestElement/spec'; export interface ObjectPattern extends BaseNode { type: AST_NODE_TYPES.ObjectPattern; properties: (Property | RestElement)[]; - typeAnnotation?: TSTypeAnnotation; - optional?: boolean; - decorators?: Decorator[]; + typeAnnotation: TSTypeAnnotation | undefined; + optional: boolean; + decorators: Decorator[]; } diff --git a/packages/ast-spec/src/parameter/RestElement/spec.ts b/packages/ast-spec/src/parameter/RestElement/spec.ts index 006f5e48ba3..59f07798864 100644 --- a/packages/ast-spec/src/parameter/RestElement/spec.ts +++ b/packages/ast-spec/src/parameter/RestElement/spec.ts @@ -8,8 +8,8 @@ import type { AssignmentPattern } from '../AssignmentPattern/spec'; export interface RestElement extends BaseNode { type: AST_NODE_TYPES.RestElement; argument: DestructuringPattern; - typeAnnotation?: TSTypeAnnotation; - optional?: boolean; - value?: AssignmentPattern; - decorators?: Decorator[]; + typeAnnotation: TSTypeAnnotation | undefined; + optional: boolean; + value: AssignmentPattern | undefined; + decorators: Decorator[]; } diff --git a/packages/ast-spec/src/parameter/TSParameterProperty/spec.ts b/packages/ast-spec/src/parameter/TSParameterProperty/spec.ts index 68e025b0fb7..56b5f559529 100644 --- a/packages/ast-spec/src/parameter/TSParameterProperty/spec.ts +++ b/packages/ast-spec/src/parameter/TSParameterProperty/spec.ts @@ -8,10 +8,10 @@ import type { RestElement } from '../RestElement/spec'; export interface TSParameterProperty extends BaseNode { type: AST_NODE_TYPES.TSParameterProperty; - accessibility?: Accessibility; - readonly?: boolean; - static?: boolean; - override?: boolean; + accessibility: Accessibility | undefined; + readonly: boolean; + static: boolean; + override: boolean; parameter: AssignmentPattern | BindingName | RestElement; - decorators?: Decorator[]; + decorators: Decorator[]; } diff --git a/packages/ast-spec/src/special/Program/spec.ts b/packages/ast-spec/src/special/Program/spec.ts index 8d84824f563..e338dbf677e 100644 --- a/packages/ast-spec/src/special/Program/spec.ts +++ b/packages/ast-spec/src/special/Program/spec.ts @@ -8,6 +8,6 @@ export interface Program extends NodeOrTokenData { type: AST_NODE_TYPES.Program; body: ProgramStatement[]; sourceType: 'module' | 'script'; - comments?: Comment[]; - tokens?: Token[]; + comments: Comment[] | undefined; + tokens: Token[] | undefined; } diff --git a/packages/ast-spec/src/special/TSTypeParameter/spec.ts b/packages/ast-spec/src/special/TSTypeParameter/spec.ts index 7487e4f5617..94430d980e8 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/spec.ts +++ b/packages/ast-spec/src/special/TSTypeParameter/spec.ts @@ -6,8 +6,8 @@ import type { TypeNode } from '../../unions/TypeNode'; export interface TSTypeParameter extends BaseNode { type: AST_NODE_TYPES.TSTypeParameter; name: Identifier; - constraint?: TypeNode; - default?: TypeNode; + constraint: TypeNode | undefined; + default: TypeNode | undefined; in: boolean; out: boolean; } diff --git a/packages/ast-spec/src/special/VariableDeclarator/spec.ts b/packages/ast-spec/src/special/VariableDeclarator/spec.ts index 619c6a57d5d..50f129faf58 100644 --- a/packages/ast-spec/src/special/VariableDeclarator/spec.ts +++ b/packages/ast-spec/src/special/VariableDeclarator/spec.ts @@ -7,5 +7,5 @@ export interface VariableDeclarator extends BaseNode { type: AST_NODE_TYPES.VariableDeclarator; id: BindingName; init: Expression | null; - definite?: boolean; + definite: boolean; } diff --git a/packages/ast-spec/src/statement/ExpressionStatement/spec.ts b/packages/ast-spec/src/statement/ExpressionStatement/spec.ts index f5fd336a960..9ae5cd1f31d 100644 --- a/packages/ast-spec/src/statement/ExpressionStatement/spec.ts +++ b/packages/ast-spec/src/statement/ExpressionStatement/spec.ts @@ -5,5 +5,5 @@ import type { Expression } from '../../unions/Expression'; export interface ExpressionStatement extends BaseNode { type: AST_NODE_TYPES.ExpressionStatement; expression: Expression; - directive?: string; + directive: string | undefined; } diff --git a/packages/ast-spec/src/type/TSMappedType/spec.ts b/packages/ast-spec/src/type/TSMappedType/spec.ts index db5abd4063a..8b81c4f77bb 100644 --- a/packages/ast-spec/src/type/TSMappedType/spec.ts +++ b/packages/ast-spec/src/type/TSMappedType/spec.ts @@ -6,8 +6,8 @@ import type { TypeNode } from '../../unions/TypeNode'; export interface TSMappedType extends BaseNode { type: AST_NODE_TYPES.TSMappedType; typeParameter: TSTypeParameter; - readonly?: boolean | '-' | '+'; - optional?: boolean | '-' | '+'; - typeAnnotation?: TypeNode; + readonly: boolean | '-' | '+' | undefined; + optional: boolean | '-' | '+' | undefined; + typeAnnotation: TypeNode | undefined; nameType: TypeNode | null; } diff --git a/packages/ast-spec/src/type/TSTypeOperator/spec.ts b/packages/ast-spec/src/type/TSTypeOperator/spec.ts index c83b8721eed..f6d530c084f 100644 --- a/packages/ast-spec/src/type/TSTypeOperator/spec.ts +++ b/packages/ast-spec/src/type/TSTypeOperator/spec.ts @@ -5,5 +5,5 @@ import type { TypeNode } from '../../unions/TypeNode'; export interface TSTypeOperator extends BaseNode { type: AST_NODE_TYPES.TSTypeOperator; operator: 'keyof' | 'readonly' | 'unique'; - typeAnnotation?: TypeNode; + typeAnnotation: TypeNode | undefined; } diff --git a/packages/ast-spec/src/type/TSTypeQuery/spec.ts b/packages/ast-spec/src/type/TSTypeQuery/spec.ts index 77318656eaa..b6ec9fdf6ec 100644 --- a/packages/ast-spec/src/type/TSTypeQuery/spec.ts +++ b/packages/ast-spec/src/type/TSTypeQuery/spec.ts @@ -7,8 +7,8 @@ import type { TSImportType } from '../TSImportType/spec'; export interface TSTypeQuery extends BaseNode { type: AST_NODE_TYPES.TSTypeQuery; exprName: EntityName | TSImportType; - typeArguments?: TSTypeParameterInstantiation; + typeArguments: TSTypeParameterInstantiation | undefined; /** @deprecated Use {@link `typeArguments`} instead. */ - typeParameters?: TSTypeParameterInstantiation; + typeParameters: TSTypeParameterInstantiation | undefined; } diff --git a/packages/ast-spec/src/type/TSTypeReference/spec.ts b/packages/ast-spec/src/type/TSTypeReference/spec.ts index a8b2a86733f..c7b5b340b2f 100644 --- a/packages/ast-spec/src/type/TSTypeReference/spec.ts +++ b/packages/ast-spec/src/type/TSTypeReference/spec.ts @@ -5,10 +5,10 @@ import type { EntityName } from '../../unions/EntityName'; export interface TSTypeReference extends BaseNode { type: AST_NODE_TYPES.TSTypeReference; - typeArguments?: TSTypeParameterInstantiation; + typeArguments: TSTypeParameterInstantiation | undefined; /** @deprecated Use {@link `typeArguments`} instead. */ - typeParameters?: TSTypeParameterInstantiation; + typeParameters: TSTypeParameterInstantiation | undefined; typeName: EntityName; } diff --git a/packages/ast-spec/tests/fixtures-with-differences-ast.shot b/packages/ast-spec/tests/fixtures-with-differences-ast.shot index 018572d503d..e593f0263e9 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-ast.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-ast.shot @@ -2,30 +2,77 @@ exports[`AST Fixtures List fixtures with AST differences 1`] = ` Set { + "declaration/ClassDeclaration/fixtures/abstract/fixture.ts", + "declaration/ClassDeclaration/fixtures/declare/fixture.ts", + "declaration/ClassDeclaration/fixtures/decorator-many/fixture.ts", + "declaration/ClassDeclaration/fixtures/decorator-one/fixture.ts", + "declaration/ClassDeclaration/fixtures/empty/fixture.ts", + "declaration/ClassDeclaration/fixtures/extends-literal/fixture.ts", "declaration/ClassDeclaration/fixtures/extends-type-param/fixture.ts", + "declaration/ClassDeclaration/fixtures/extends/fixture.ts", "declaration/ClassDeclaration/fixtures/implements-many/fixture.ts", "declaration/ClassDeclaration/fixtures/implements-one/fixture.ts", "declaration/ClassDeclaration/fixtures/type-param/fixture.ts", "declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/fixture.ts", "declaration/ClassDeclaration/fixtures/with-member-one/fixture.ts", + "declaration/ExportAllDeclaration/fixtures/assertion/fixture.ts", + "declaration/ExportAllDeclaration/fixtures/named/fixture.ts", + "declaration/ExportDefaultDeclaration/fixtures/anonymous-class/fixture.ts", + "declaration/ExportDefaultDeclaration/fixtures/anonymous-function/fixture.ts", + "declaration/ExportDefaultDeclaration/fixtures/class-expression/fixture.ts", + "declaration/ExportDefaultDeclaration/fixtures/class/fixture.ts", + "declaration/ExportDefaultDeclaration/fixtures/function/fixture.ts", + "declaration/ExportDefaultDeclaration/fixtures/identifier/fixture.ts", + "declaration/ExportDefaultDeclaration/fixtures/interface/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/aliased/fixture.ts", + "declaration/ExportNamedDeclaration/fixtures/class/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/declare-function/fixture.ts", + "declaration/ExportNamedDeclaration/fixtures/enum/fixture.ts", + "declaration/ExportNamedDeclaration/fixtures/function-declaration/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/identifier-braced/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/identifier-many/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/interface/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/namespace/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/type-alias/fixture.ts", + "declaration/ExportNamedDeclaration/fixtures/variable-declaration/fixture.ts", + "declaration/FunctionDeclaration/fixtures/async/fixture.ts", + "declaration/FunctionDeclaration/fixtures/empty/fixture.ts", + "declaration/FunctionDeclaration/fixtures/generator/fixture.ts", + "declaration/FunctionDeclaration/fixtures/param-many/fixture.ts", + "declaration/FunctionDeclaration/fixtures/param-one/fixture.ts", + "declaration/FunctionDeclaration/fixtures/returnType/fixture.ts", "declaration/FunctionDeclaration/fixtures/type-param-many/fixture.ts", "declaration/FunctionDeclaration/fixtures/type-param-one/fixture.ts", + "declaration/ImportDeclaration/fixtures/assertion/fixture.ts", + "declaration/ImportDeclaration/fixtures/default-and-named-many/fixture.ts", + "declaration/ImportDeclaration/fixtures/default-and-named-none/fixture.ts", + "declaration/ImportDeclaration/fixtures/default-and-named-one/fixture.ts", + "declaration/ImportDeclaration/fixtures/default-and-namespace/fixture.ts", + "declaration/ImportDeclaration/fixtures/default/fixture.ts", + "declaration/ImportDeclaration/fixtures/named-many/fixture.ts", + "declaration/ImportDeclaration/fixtures/named-one/fixture.ts", + "declaration/TSDeclareFunction/fixtures/empty/fixture.ts", + "declaration/TSDeclareFunction/fixtures/generator/fixture.ts", + "declaration/TSDeclareFunction/fixtures/param-many/fixture.ts", + "declaration/TSDeclareFunction/fixtures/param-one/fixture.ts", + "declaration/TSDeclareFunction/fixtures/returnType/fixture.ts", "declaration/TSDeclareFunction/fixtures/type-param-many/fixture.ts", "declaration/TSDeclareFunction/fixtures/type-param-one/fixture.ts", + "declaration/TSDeclareFunction/fixtures/without-declare/fixture.ts", + "declaration/TSEnumDeclaration/fixtures/const/fixture.ts", + "declaration/TSEnumDeclaration/fixtures/declare/fixture.ts", + "declaration/TSEnumDeclaration/fixtures/empty/fixture.ts", + "declaration/TSEnumDeclaration/fixtures/with-member-one/fixture.ts", "declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/fixture.ts", "declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/fixture.ts", "declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/fixture.ts", + "declaration/TSInterfaceDeclaration/fixtures/declare/fixture.ts", + "declaration/TSInterfaceDeclaration/fixtures/empty/fixture.ts", "declaration/TSInterfaceDeclaration/fixtures/extends-many/fixture.ts", "declaration/TSInterfaceDeclaration/fixtures/extends-one/fixture.ts", "declaration/TSInterfaceDeclaration/fixtures/type-param-many/fixture.ts", "declaration/TSInterfaceDeclaration/fixtures/type-param-one/fixture.ts", + "declaration/TSInterfaceDeclaration/fixtures/with-member-one/fixture.ts", "declaration/TSModuleDeclaration/fixtures/global/fixture.ts", "declaration/TSModuleDeclaration/fixtures/module-declare-no-body/fixture.ts", "declaration/TSModuleDeclaration/fixtures/module-declare/fixture.ts", @@ -37,8 +84,19 @@ Set { "declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/fixture.ts", "declaration/TSModuleDeclaration/fixtures/namespace-nested-once/fixture.ts", "declaration/TSModuleDeclaration/fixtures/namespace-nested-twice/fixture.ts", + "declaration/TSNamespaceExportDeclaration/fixtures/valid/fixture.ts", + "declaration/TSTypeAliasDeclaration/fixtures/declare/fixture.ts", "declaration/TSTypeAliasDeclaration/fixtures/type-param-many/fixture.ts", "declaration/TSTypeAliasDeclaration/fixtures/type-param-one/fixture.ts", + "declaration/TSTypeAliasDeclaration/fixtures/valid/fixture.ts", + "declaration/VariableDeclaration/fixtures/const-with-value/fixture.ts", + "declaration/VariableDeclaration/fixtures/const-without-value/fixture.ts", + "declaration/VariableDeclaration/fixtures/declare/fixture.ts", + "declaration/VariableDeclaration/fixtures/let-with-value/fixture.ts", + "declaration/VariableDeclaration/fixtures/let-without-value/fixture.ts", + "declaration/VariableDeclaration/fixtures/multiple-declarations/fixture.ts", + "declaration/VariableDeclaration/fixtures/var-with-value/fixture.ts", + "declaration/VariableDeclaration/fixtures/var-without-value/fixture.ts", "element/AccessorProperty/fixtures/key-computed-complex/fixture.ts", "element/AccessorProperty/fixtures/key-computed-number/fixture.ts", "element/AccessorProperty/fixtures/key-computed-string/fixture.ts", @@ -59,6 +117,16 @@ Set { "element/AccessorProperty/fixtures/with-annotation-no-value/fixture.ts", "element/AccessorProperty/fixtures/with-annotation-with-value/fixture.ts", "expression/TSSatisfiesExpression/fixtures/arrow-func-with-parentheses/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/chained-satisfies/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/conditional-no-parentheses/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/conditional-with-parentheses/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/identifier-keyword/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/identifier-object-type/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/identifier-tuple-type/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/logical-no-parentheses/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/logical-with-parentheses/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/object-object-inner-parentheses/fixture.ts", + "expression/TSSatisfiesExpression/fixtures/object-object-outer-parentheses/fixture.ts", "legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-instance-member/fixture.ts", "legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-factory-static-member/fixture.ts", "legacy-fixtures/accessor-decorators/fixtures/accessor-decorator-instance-member/fixture.ts", @@ -72,9 +140,23 @@ Set { "legacy-fixtures/basics/fixtures/abstract-class-with-declare-properties/fixture.ts", "legacy-fixtures/basics/fixtures/abstract-class-with-optional-method/fixture.ts", "legacy-fixtures/basics/fixtures/abstract-class-with-override-method/fixture.ts", + "legacy-fixtures/basics/fixtures/angle-bracket-type-assertion-arrow-function/fixture.ts", + "legacy-fixtures/basics/fixtures/angle-bracket-type-assertion/fixture.ts", + "legacy-fixtures/basics/fixtures/arrow-function-with-optional-parameter/fixture.ts", "legacy-fixtures/basics/fixtures/arrow-function-with-type-parameters/fixture.ts", + "legacy-fixtures/basics/fixtures/async-function-expression/fixture.ts", + "legacy-fixtures/basics/fixtures/async-function-with-var-declaration/fixture.ts", "legacy-fixtures/basics/fixtures/call-signatures-with-generics/fixture.ts", "legacy-fixtures/basics/fixtures/call-signatures/fixture.ts", + "legacy-fixtures/basics/fixtures/cast-as-expression/fixture.ts", + "legacy-fixtures/basics/fixtures/cast-as-multi-assign/fixture.ts", + "legacy-fixtures/basics/fixtures/cast-as-multi/fixture.ts", + "legacy-fixtures/basics/fixtures/cast-as-operator/fixture.ts", + "legacy-fixtures/basics/fixtures/cast-as-simple/fixture.ts", + "legacy-fixtures/basics/fixtures/catch-clause-with-annotation/fixture.ts", + "legacy-fixtures/basics/fixtures/catch-clause-with-invalid-annotation/fixture.ts", + "legacy-fixtures/basics/fixtures/class-multi-line-keyword-abstract/fixture.ts", + "legacy-fixtures/basics/fixtures/class-multi-line-keyword-declare/fixture.ts", "legacy-fixtures/basics/fixtures/class-private-identifier-field-with-annotation/fixture.ts", "legacy-fixtures/basics/fixtures/class-private-identifier-readonly-field/fixture.ts", "legacy-fixtures/basics/fixtures/class-static-blocks/fixture.ts", @@ -101,6 +183,7 @@ Set { "legacy-fixtures/basics/fixtures/class-with-optional-methods/fixture.ts", "legacy-fixtures/basics/fixtures/class-with-optional-properties/fixture.ts", "legacy-fixtures/basics/fixtures/class-with-optional-property-undefined/fixture.ts", + "legacy-fixtures/basics/fixtures/class-with-override-method/fixture.ts", "legacy-fixtures/basics/fixtures/class-with-override-property/fixture.ts", "legacy-fixtures/basics/fixtures/class-with-private-optional-property/fixture.ts", "legacy-fixtures/basics/fixtures/class-with-private-parameter-properties/fixture.ts", @@ -113,9 +196,18 @@ Set { "legacy-fixtures/basics/fixtures/class-with-type-parameter-default/fixture.ts", "legacy-fixtures/basics/fixtures/class-with-type-parameter-underscore/fixture.ts", "legacy-fixtures/basics/fixtures/class-with-type-parameter/fixture.ts", + "legacy-fixtures/basics/fixtures/const-enum/fixture.ts", "legacy-fixtures/basics/fixtures/declare-class-with-optional-method/fixture.ts", + "legacy-fixtures/basics/fixtures/declare-function/fixture.ts", + "legacy-fixtures/basics/fixtures/destructuring-assignment-nested/fixture.ts", + "legacy-fixtures/basics/fixtures/destructuring-assignment-object/fixture.ts", + "legacy-fixtures/basics/fixtures/destructuring-assignment-property/fixture.ts", + "legacy-fixtures/basics/fixtures/destructuring-assignment/fixture.ts", "legacy-fixtures/basics/fixtures/directive-in-module/fixture.ts", "legacy-fixtures/basics/fixtures/directive-in-namespace/fixture.ts", + "legacy-fixtures/basics/fixtures/dynamic-import-with-import-assertions/fixture.ts", + "legacy-fixtures/basics/fixtures/export-all-with-import-assertions/fixture.ts", + "legacy-fixtures/basics/fixtures/export-as-namespace/fixture.ts", "legacy-fixtures/basics/fixtures/export-assignment/fixture.ts", "legacy-fixtures/basics/fixtures/export-declare-const-named-enum/fixture.ts", "legacy-fixtures/basics/fixtures/export-declare-named-enum/fixture.ts", @@ -124,23 +216,34 @@ Set { "legacy-fixtures/basics/fixtures/export-default-interface/fixture.ts", "legacy-fixtures/basics/fixtures/export-named-class-with-generic/fixture.ts", "legacy-fixtures/basics/fixtures/export-named-class-with-multiple-generics/fixture.ts", + "legacy-fixtures/basics/fixtures/export-named-enum/fixture.ts", + "legacy-fixtures/basics/fixtures/export-star-as-ns-from/fixture.ts", "legacy-fixtures/basics/fixtures/export-type-as/fixture.ts", "legacy-fixtures/basics/fixtures/export-type-from-as/fixture.ts", "legacy-fixtures/basics/fixtures/export-type-from/fixture.ts", "legacy-fixtures/basics/fixtures/export-type/fixture.ts", "legacy-fixtures/basics/fixtures/function-anonymus-with-type-parameters/fixture.ts", + "legacy-fixtures/basics/fixtures/function-anynomus-with-return-type/fixture.ts", + "legacy-fixtures/basics/fixtures/function-overloads/fixture.ts", + "legacy-fixtures/basics/fixtures/function-with-await/fixture.ts", + "legacy-fixtures/basics/fixtures/function-with-object-type-with-optional-properties/fixture.ts", + "legacy-fixtures/basics/fixtures/function-with-object-type-without-annotation/fixture.ts", "legacy-fixtures/basics/fixtures/function-with-type-parameters-that-have-comments/fixture.ts", "legacy-fixtures/basics/fixtures/function-with-type-parameters-with-constraint/fixture.ts", "legacy-fixtures/basics/fixtures/function-with-type-parameters/fixture.ts", "legacy-fixtures/basics/fixtures/function-with-types-assignation/fixture.ts", + "legacy-fixtures/basics/fixtures/function-with-types/fixture.ts", + "legacy-fixtures/basics/fixtures/global-this/fixture.ts", "legacy-fixtures/basics/fixtures/import-equal-declaration/fixture.ts", "legacy-fixtures/basics/fixtures/import-equal-type-declaration/fixture.ts", "legacy-fixtures/basics/fixtures/import-export-equal-declaration/fixture.ts", "legacy-fixtures/basics/fixtures/import-export-equal-type-declaration/fixture.ts", "legacy-fixtures/basics/fixtures/import-type-default/fixture.ts", + "legacy-fixtures/basics/fixtures/import-type-empty/fixture.ts", "legacy-fixtures/basics/fixtures/import-type-named-as/fixture.ts", "legacy-fixtures/basics/fixtures/import-type-named/fixture.ts", "legacy-fixtures/basics/fixtures/import-type-star-as-ns/fixture.ts", + "legacy-fixtures/basics/fixtures/import-with-import-assertions/fixture.ts", "legacy-fixtures/basics/fixtures/interface-extends-multiple/fixture.ts", "legacy-fixtures/basics/fixtures/interface-extends/fixture.ts", "legacy-fixtures/basics/fixtures/interface-type-parameters/fixture.ts", @@ -151,39 +254,94 @@ Set { "legacy-fixtures/basics/fixtures/interface-with-jsdoc/fixture.ts", "legacy-fixtures/basics/fixtures/interface-with-method/fixture.ts", "legacy-fixtures/basics/fixtures/interface-with-optional-properties/fixture.ts", + "legacy-fixtures/basics/fixtures/interface-without-type-annotation/fixture.ts", "legacy-fixtures/basics/fixtures/intrinsic-keyword/fixture.ts", + "legacy-fixtures/basics/fixtures/keyof-operator/fixture.ts", "legacy-fixtures/basics/fixtures/keyword-variables/fixture.ts", "legacy-fixtures/basics/fixtures/nested-type-arguments/fixture.ts", "legacy-fixtures/basics/fixtures/never-type-param/fixture.ts", + "legacy-fixtures/basics/fixtures/non-null-assertion-operator/fixture.ts", + "legacy-fixtures/basics/fixtures/null-and-undefined-type-annotations/fixture.ts", + "legacy-fixtures/basics/fixtures/nullish-coalescing/fixture.ts", "legacy-fixtures/basics/fixtures/object-with-escaped-properties/fixture.ts", "legacy-fixtures/basics/fixtures/object-with-typed-methods/fixture.ts", + "legacy-fixtures/basics/fixtures/optional-chain-call-with-non-null-assertion/fixture.ts", + "legacy-fixtures/basics/fixtures/optional-chain-call-with-parens/fixture.ts", + "legacy-fixtures/basics/fixtures/optional-chain-call/fixture.ts", + "legacy-fixtures/basics/fixtures/optional-chain-element-access-with-non-null-assertion/fixture.ts", + "legacy-fixtures/basics/fixtures/optional-chain-element-access-with-parens/fixture.ts", + "legacy-fixtures/basics/fixtures/optional-chain-element-access/fixture.ts", + "legacy-fixtures/basics/fixtures/optional-chain-with-non-null-assertion/fixture.ts", + "legacy-fixtures/basics/fixtures/optional-chain-with-parens/fixture.ts", + "legacy-fixtures/basics/fixtures/optional-chain/fixture.ts", "legacy-fixtures/basics/fixtures/private-fields-in-in/fixture.ts", "legacy-fixtures/basics/fixtures/readonly-arrays/fixture.ts", + "legacy-fixtures/basics/fixtures/readonly-tuples/fixture.ts", + "legacy-fixtures/basics/fixtures/short-circuiting-assignment-and-and/fixture.ts", + "legacy-fixtures/basics/fixtures/short-circuiting-assignment-or-or/fixture.ts", + "legacy-fixtures/basics/fixtures/short-circuiting-assignment-question-question/fixture.ts", "legacy-fixtures/basics/fixtures/symbol-type-param/fixture.ts", "legacy-fixtures/basics/fixtures/type-alias-declaration-export-function-type/fixture.ts", "legacy-fixtures/basics/fixtures/type-alias-declaration-export-object-type/fixture.ts", "legacy-fixtures/basics/fixtures/type-alias-declaration-export/fixture.ts", "legacy-fixtures/basics/fixtures/type-alias-declaration-with-constrained-type-parameter/fixture.ts", "legacy-fixtures/basics/fixtures/type-alias-declaration/fixture.ts", + "legacy-fixtures/basics/fixtures/type-alias-object-without-annotation/fixture.ts", + "legacy-fixtures/basics/fixtures/type-assertion-in-arrow-function/fixture.ts", + "legacy-fixtures/basics/fixtures/type-assertion-in-function/fixture.ts", "legacy-fixtures/basics/fixtures/type-assertion-in-interface/fixture.ts", "legacy-fixtures/basics/fixtures/type-assertion-in-method/fixture.ts", + "legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-arrow-function/fixture.ts", + "legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-function/fixture.ts", "legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-interface/fixture.ts", "legacy-fixtures/basics/fixtures/type-assertion-with-guard-in-method/fixture.ts", + "legacy-fixtures/basics/fixtures/type-guard-in-arrow-function/fixture.ts", + "legacy-fixtures/basics/fixtures/type-guard-in-function/fixture.ts", "legacy-fixtures/basics/fixtures/type-guard-in-interface/fixture.ts", "legacy-fixtures/basics/fixtures/type-guard-in-method/fixture.ts", "legacy-fixtures/basics/fixtures/type-import-type-with-type-parameters-in-type-reference/fixture.ts", "legacy-fixtures/basics/fixtures/type-import-type/fixture.ts", + "legacy-fixtures/basics/fixtures/type-only-export-specifiers/fixture.ts", + "legacy-fixtures/basics/fixtures/type-only-import-specifiers/fixture.ts", "legacy-fixtures/basics/fixtures/type-parameters-comments-heritage/fixture.ts", "legacy-fixtures/basics/fixtures/type-parameters-comments/fixture.ts", "legacy-fixtures/basics/fixtures/type-reference-comments/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-bigint/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-boolean/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-false/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-never/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-null/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-number/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-object/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-string/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-symbol/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-true/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-undefined/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-unknown/fixture.ts", + "legacy-fixtures/basics/fixtures/typed-keyword-void/fixture.ts", "legacy-fixtures/basics/fixtures/typed-method-signature/fixture.ts", "legacy-fixtures/basics/fixtures/typed-this/fixture.ts", "legacy-fixtures/basics/fixtures/union-intersection/fixture.ts", + "legacy-fixtures/basics/fixtures/unique-symbol/fixture.ts", + "legacy-fixtures/basics/fixtures/unknown-type-annotation/fixture.ts", + "legacy-fixtures/basics/fixtures/var-with-dotted-type/fixture.ts", + "legacy-fixtures/basics/fixtures/var-with-type/fixture.ts", + "legacy-fixtures/basics/fixtures/variable-declaration-type-annotation-spacing/fixture.ts", + "legacy-fixtures/class-decorators/fixtures/class-decorator-factory/fixture.ts", + "legacy-fixtures/class-decorators/fixtures/class-decorator/fixture.ts", "legacy-fixtures/class-decorators/fixtures/class-parameter-property/fixture.ts", "legacy-fixtures/class-decorators/fixtures/export-default-class-decorator/fixture.ts", "legacy-fixtures/class-decorators/fixtures/export-named-class-decorator/fixture.ts", + "legacy-fixtures/comments/fixtures/type-assertion-regression-test/fixture.ts", + "legacy-fixtures/declare/fixtures/abstract-class/fixture.ts", + "legacy-fixtures/declare/fixtures/class/fixture.ts", + "legacy-fixtures/declare/fixtures/enum/fixture.ts", + "legacy-fixtures/declare/fixtures/function/fixture.ts", + "legacy-fixtures/declare/fixtures/interface/fixture.ts", "legacy-fixtures/declare/fixtures/module/fixture.ts", "legacy-fixtures/declare/fixtures/namespace/fixture.ts", + "legacy-fixtures/declare/fixtures/type-alias/fixture.ts", + "legacy-fixtures/declare/fixtures/variable/fixture.ts", "legacy-fixtures/expressions/fixtures/call-expression-type-arguments/fixture.ts", "legacy-fixtures/expressions/fixtures/new-expression-type-arguments/fixture.ts", "legacy-fixtures/expressions/fixtures/optional-call-expression-type-arguments/fixture.ts", @@ -208,10 +366,13 @@ Set { "legacy-fixtures/property-decorators/fixtures/property-decorator-factory-static-member/fixture.ts", "legacy-fixtures/property-decorators/fixtures/property-decorator-instance-member/fixture.ts", "legacy-fixtures/property-decorators/fixtures/property-decorator-static-member/fixture.ts", + "legacy-fixtures/types/fixtures/array-type/fixture.ts", "legacy-fixtures/types/fixtures/conditional-infer-nested/fixture.ts", "legacy-fixtures/types/fixtures/conditional-infer-simple/fixture.ts", "legacy-fixtures/types/fixtures/conditional-infer-with-constraint/fixture.ts", "legacy-fixtures/types/fixtures/conditional-infer/fixture.ts", + "legacy-fixtures/types/fixtures/conditional-with-null/fixture.ts", + "legacy-fixtures/types/fixtures/conditional/fixture.ts", "legacy-fixtures/types/fixtures/constructor-abstract/fixture.ts", "legacy-fixtures/types/fixtures/constructor-empty/fixture.ts", "legacy-fixtures/types/fixtures/constructor-generic/fixture.ts", @@ -225,8 +386,15 @@ Set { "legacy-fixtures/types/fixtures/function-with-rest/fixture.ts", "legacy-fixtures/types/fixtures/function-with-this/fixture.ts", "legacy-fixtures/types/fixtures/function/fixture.ts", + "legacy-fixtures/types/fixtures/index-signature-readonly/fixture.ts", + "legacy-fixtures/types/fixtures/index-signature-without-type/fixture.ts", + "legacy-fixtures/types/fixtures/index-signature/fixture.ts", + "legacy-fixtures/types/fixtures/indexed/fixture.ts", "legacy-fixtures/types/fixtures/interface-with-accessors/fixture.ts", "legacy-fixtures/types/fixtures/intersection-type/fixture.ts", + "legacy-fixtures/types/fixtures/literal-number-negative/fixture.ts", + "legacy-fixtures/types/fixtures/literal-number/fixture.ts", + "legacy-fixtures/types/fixtures/literal-string/fixture.ts", "legacy-fixtures/types/fixtures/mapped-named-type/fixture.ts", "legacy-fixtures/types/fixtures/mapped-readonly-minus/fixture.ts", "legacy-fixtures/types/fixtures/mapped-readonly-plus/fixture.ts", @@ -239,16 +407,31 @@ Set { "legacy-fixtures/types/fixtures/optional-variance-in-out/fixture.ts", "legacy-fixtures/types/fixtures/optional-variance-in/fixture.ts", "legacy-fixtures/types/fixtures/optional-variance-out/fixture.ts", + "legacy-fixtures/types/fixtures/parenthesized-type/fixture.ts", "legacy-fixtures/types/fixtures/reference-generic-nested/fixture.ts", "legacy-fixtures/types/fixtures/reference-generic/fixture.ts", + "legacy-fixtures/types/fixtures/reference/fixture.ts", + "legacy-fixtures/types/fixtures/template-literal-type-1/fixture.ts", "legacy-fixtures/types/fixtures/template-literal-type-2/fixture.ts", "legacy-fixtures/types/fixtures/template-literal-type-3/fixture.ts", "legacy-fixtures/types/fixtures/template-literal-type-4/fixture.ts", "legacy-fixtures/types/fixtures/this-type-expanded/fixture.ts", "legacy-fixtures/types/fixtures/this-type/fixture.ts", + "legacy-fixtures/types/fixtures/tuple-empty/fixture.ts", + "legacy-fixtures/types/fixtures/tuple-named-optional/fixture.ts", + "legacy-fixtures/types/fixtures/tuple-named-rest/fixture.ts", + "legacy-fixtures/types/fixtures/tuple-named-type/fixture.ts", + "legacy-fixtures/types/fixtures/tuple-named/fixture.ts", "legacy-fixtures/types/fixtures/tuple-optional/fixture.ts", + "legacy-fixtures/types/fixtures/tuple-rest/fixture.ts", + "legacy-fixtures/types/fixtures/tuple-type/fixture.ts", + "legacy-fixtures/types/fixtures/tuple/fixture.ts", + "legacy-fixtures/types/fixtures/type-literal/fixture.ts", + "legacy-fixtures/types/fixtures/type-operator/fixture.ts", "legacy-fixtures/types/fixtures/typeof-this/fixture.ts", "legacy-fixtures/types/fixtures/typeof-with-type-parameters/fixture.ts", + "legacy-fixtures/types/fixtures/typeof/fixture.ts", "legacy-fixtures/types/fixtures/union-intersection/fixture.ts", + "legacy-fixtures/types/fixtures/union-type/fixture.ts", } `; diff --git a/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts b/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts index 5d2f1118202..d8ae71bec1d 100644 --- a/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts +++ b/packages/eslint-plugin/src/rules/consistent-indexed-object-style.ts @@ -132,8 +132,8 @@ export default createRule({ TSInterfaceDeclaration(node): void { let genericTypes = ''; - if ((node.typeParameters?.params ?? []).length > 0) { - genericTypes = `<${node.typeParameters?.params + if (node.typeParameters?.params?.length) { + genericTypes = `<${node.typeParameters.params .map(p => sourceCode.getText(p)) .join(', ')}>`; } diff --git a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts index b095b903162..efaece677b1 100644 --- a/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts +++ b/packages/eslint-plugin/src/rules/explicit-member-accessibility.ts @@ -229,7 +229,7 @@ export default util.createRule({ accessibility: TSESTree.Accessibility, fixer: TSESLint.RuleFixer, ): TSESLint.RuleFix | null { - if (node?.decorators?.length) { + if (node?.decorators.length) { const lastDecorator = node.decorators[node.decorators.length - 1]; const nextToken = sourceCode.getTokenAfter(lastDecorator)!; return fixer.insertTextBefore(nextToken, `${accessibility} `); diff --git a/packages/eslint-plugin/src/rules/indent.ts b/packages/eslint-plugin/src/rules/indent.ts index afb60fa0a23..80d81293dd0 100644 --- a/packages/eslint-plugin/src/rules/indent.ts +++ b/packages/eslint-plugin/src/rules/indent.ts @@ -162,9 +162,15 @@ export default util.createRule({ } else { return { type, - static: false, - readonly: false, + accessibility: undefined, declare: false, + decorators: [], + definite: false, + optional: false, + override: false, + readonly: false, + static: false, + typeAnnotation: undefined, ...base, } as TSESTree.PropertyDefinition; } @@ -297,6 +303,7 @@ export default util.createRule({ }, } as TSESTree.VariableDeclarator, ], + declare: false, // location data parent: node.parent, @@ -351,7 +358,14 @@ export default util.createRule({ body: node.body as any, id: null, // TODO: This is invalid, there can be more than one extends in interface - superClass: node.extends![0].expression as any, + superClass: node.extends[0].expression as any, + abstract: false, + declare: false, + decorators: [], + implements: [], + superTypeArguments: undefined, + superTypeParameters: undefined, + typeParameters: undefined, // location data parent: node.parent, @@ -392,6 +406,7 @@ export default util.createRule({ kind: 'init' as const, computed: false, method: false, + optional: false, shorthand: false, }, ], @@ -458,6 +473,8 @@ export default util.createRule({ selfClosing: false, name: name as any, attributes: attributes as any, + typeArguments: undefined, + typeParameters: undefined, // location data parent: node.parent, diff --git a/packages/eslint-plugin/src/rules/member-ordering.ts b/packages/eslint-plugin/src/rules/member-ordering.ts index a50cf6ba18d..34eddde6e8b 100644 --- a/packages/eslint-plugin/src/rules/member-ordering.ts +++ b/packages/eslint-plugin/src/rules/member-ordering.ts @@ -511,7 +511,7 @@ function getRank( const memberGroups: BaseMemberType[] = []; if (supportsModifiers) { - const decorated = 'decorators' in node && node.decorators!.length > 0; + const decorated = 'decorators' in node && node.decorators.length > 0; if ( decorated && (type === 'field' || diff --git a/packages/eslint-plugin/src/rules/no-unnecessary-type-constraint.ts b/packages/eslint-plugin/src/rules/no-unnecessary-type-constraint.ts index 246d44af6f3..969dfbe8db2 100644 --- a/packages/eslint-plugin/src/rules/no-unnecessary-type-constraint.ts +++ b/packages/eslint-plugin/src/rules/no-unnecessary-type-constraint.ts @@ -3,9 +3,9 @@ import { AST_NODE_TYPES } from '@typescript-eslint/utils'; import * as util from '../util'; -type MakeRequired = Omit & - Required>; - +type MakeRequired = Omit & { + [K in Key]-?: NonNullable; +}; type TypeParameterWithConstraint = MakeRequired< TSESTree.TSTypeParameter, 'constraint' diff --git a/packages/eslint-plugin/src/rules/no-useless-constructor.ts b/packages/eslint-plugin/src/rules/no-useless-constructor.ts index c37dd213621..6409b8a48c3 100644 --- a/packages/eslint-plugin/src/rules/no-useless-constructor.ts +++ b/packages/eslint-plugin/src/rules/no-useless-constructor.ts @@ -37,7 +37,7 @@ function checkParams(node: TSESTree.MethodDefinition): boolean { return !node.value.params.some( param => param.type === AST_NODE_TYPES.TSParameterProperty || - param.decorators?.length, + param.decorators.length, ); } diff --git a/packages/eslint-plugin/src/rules/promise-function-async.ts b/packages/eslint-plugin/src/rules/promise-function-async.ts index 7cdae3179fa..ba671d5929b 100644 --- a/packages/eslint-plugin/src/rules/promise-function-async.ts +++ b/packages/eslint-plugin/src/rules/promise-function-async.ts @@ -162,7 +162,7 @@ export default util.createRule({ // if there are decorators then skip past them if ( method.type === AST_NODE_TYPES.MethodDefinition && - method.decorators + method.decorators.length ) { const lastDecorator = method.decorators[method.decorators.length - 1]; diff --git a/packages/eslint-plugin/src/rules/unified-signatures.ts b/packages/eslint-plugin/src/rules/unified-signatures.ts index 18d332d76f8..9534ef190b2 100644 --- a/packages/eslint-plugin/src/rules/unified-signatures.ts +++ b/packages/eslint-plugin/src/rules/unified-signatures.ts @@ -424,8 +424,7 @@ export default util.createRule({ return ( (a.type === AST_NODE_TYPES.RestElement) === - (b.type === AST_NODE_TYPES.RestElement) && - (optionalA !== undefined) === (optionalB !== undefined) + (b.type === AST_NODE_TYPES.RestElement) && optionalA === optionalB ); } diff --git a/packages/parser/tests/lib/__snapshots__/services.ts.snap b/packages/parser/tests/lib/__snapshots__/services.ts.snap index 7dfa8a7b4d4..e9e804b60eb 100644 --- a/packages/parser/tests/lib/__snapshots__/services.ts.snap +++ b/packages/parser/tests/lib/__snapshots__/services.ts.snap @@ -6,7 +6,9 @@ exports[`services fixtures/isolated-file.src 1`] = ` { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -18,6 +20,7 @@ exports[`services fixtures/isolated-file.src 1`] = ` }, }, "name": "x", + "optional": false, "range": [ 6, 7, @@ -117,6 +120,7 @@ exports[`services fixtures/isolated-file.src 1`] = ` "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { diff --git a/packages/scope-manager/src/referencer/ClassVisitor.ts b/packages/scope-manager/src/referencer/ClassVisitor.ts index a01cc78191e..e1653cbd218 100644 --- a/packages/scope-manager/src/referencer/ClassVisitor.ts +++ b/packages/scope-manager/src/referencer/ClassVisitor.ts @@ -57,7 +57,7 @@ class ClassVisitor extends Visitor { .defineIdentifier(node.id, new ClassNameDefinition(node.id, node)); } - node.decorators?.forEach(d => this.#referencer.visit(d)); + node.decorators.forEach(d => this.#referencer.visit(d)); this.#referencer.scopeManager.nestClassScope(node); @@ -96,19 +96,25 @@ class ClassVisitor extends Visitor { * foo: Type; * } */ - this.visitMetadataType(node.typeAnnotation, !!node.decorators); + this.visitMetadataType(node.typeAnnotation, !!node.decorators.length); } protected visitFunctionParameterTypeAnnotation( node: TSESTree.Parameter, withDecorators: boolean, ): void { - if ('typeAnnotation' in node) { - this.visitMetadataType(node.typeAnnotation, withDecorators); - } else if (node.type === AST_NODE_TYPES.AssignmentPattern) { - this.visitMetadataType(node.left.typeAnnotation, withDecorators); - } else if (node.type === AST_NODE_TYPES.TSParameterProperty) { - this.visitFunctionParameterTypeAnnotation(node.parameter, withDecorators); + switch (node.type) { + case AST_NODE_TYPES.AssignmentPattern: + this.visitMetadataType(node.left.typeAnnotation, withDecorators); + break; + case AST_NODE_TYPES.TSParameterProperty: + this.visitFunctionParameterTypeAnnotation( + node.parameter, + withDecorators, + ); + break; + default: + this.visitMetadataType(node.typeAnnotation, withDecorators); } } @@ -134,7 +140,7 @@ class ClassVisitor extends Visitor { * foo(): Type {} * } */ - let withMethodDecorators = !!methodNode.decorators; + let withMethodDecorators = !!methodNode.decorators.length; /** * class A { * foo( @@ -151,7 +157,7 @@ class ClassVisitor extends Visitor { withMethodDecorators = withMethodDecorators || (methodNode.kind !== 'set' && - node.params.some(param => param.decorators)); + node.params.some(param => param.decorators.length)); if (!withMethodDecorators && methodNode.kind === 'set') { const keyName = getLiteralMethodKeyName(methodNode); @@ -171,7 +177,7 @@ class ClassVisitor extends Visitor { // Node must both be static or not node.static === methodNode.static && getLiteralMethodKeyName(node) === keyName, - )?.decorators + )?.decorators.length ) { withMethodDecorators = true; } @@ -213,7 +219,7 @@ class ClassVisitor extends Visitor { { processRightHandNodes: true }, ); this.visitFunctionParameterTypeAnnotation(param, withMethodDecorators); - param.decorators?.forEach(d => this.visit(d)); + param.decorators.forEach(d => this.visit(d)); } this.visitMetadataType(node.returnType, withMethodDecorators); @@ -265,9 +271,7 @@ class ClassVisitor extends Visitor { } } - if ('decorators' in node) { - node.decorators?.forEach(d => this.#referencer.visit(d)); - } + node.decorators.forEach(d => this.#referencer.visit(d)); } protected visitMethod(node: TSESTree.MethodDefinition): void { @@ -281,9 +285,7 @@ class ClassVisitor extends Visitor { this.#referencer.visit(node.value); } - if ('decorators' in node) { - node.decorators?.forEach(d => this.#referencer.visit(d)); - } + node.decorators.forEach(d => this.#referencer.visit(d)); } protected visitType(node: TSESTree.Node | null | undefined): void { diff --git a/packages/scope-manager/src/referencer/Referencer.ts b/packages/scope-manager/src/referencer/Referencer.ts index 0a2cd05586a..90f75490904 100644 --- a/packages/scope-manager/src/referencer/Referencer.ts +++ b/packages/scope-manager/src/referencer/Referencer.ts @@ -211,12 +211,16 @@ class Referencer extends Visitor { protected visitFunctionParameterTypeAnnotation( node: TSESTree.Parameter, ): void { - if ('typeAnnotation' in node) { - this.visitType(node.typeAnnotation); - } else if (node.type === AST_NODE_TYPES.AssignmentPattern) { - this.visitType(node.left.typeAnnotation); - } else if (node.type === AST_NODE_TYPES.TSParameterProperty) { - this.visitFunctionParameterTypeAnnotation(node.parameter); + switch (node.type) { + case AST_NODE_TYPES.AssignmentPattern: + this.visitType(node.left.typeAnnotation); + break; + case AST_NODE_TYPES.TSParameterProperty: + this.visitFunctionParameterTypeAnnotation(node.parameter); + break; + default: + this.visitType(node.typeAnnotation); + break; } } protected visitFunction( @@ -265,7 +269,7 @@ class Referencer extends Visitor { { processRightHandNodes: true }, ); this.visitFunctionParameterTypeAnnotation(param); - param.decorators?.forEach(d => this.visit(d)); + param.decorators.forEach(d => this.visit(d)); } this.visitType(node.returnType); @@ -779,13 +783,8 @@ class Referencer extends Visitor { { processRightHandNodes: true }, ); - if (decl.init) { - this.visit(decl.init); - } - - if ('typeAnnotation' in decl.id) { - this.visitType(decl.id.typeAnnotation); - } + this.visit(decl.init); + this.visitType(decl.id.typeAnnotation); } } diff --git a/packages/scope-manager/tests/fixtures/class/emit-metadata/nested-class-inner.ts.shot b/packages/scope-manager/tests/fixtures/class/emit-metadata/nested-class-inner.ts.shot index 963402a9036..7d2367151cf 100644 --- a/packages/scope-manager/tests/fixtures/class/emit-metadata/nested-class-inner.ts.shot +++ b/packages/scope-manager/tests/fixtures/class/emit-metadata/nested-class-inner.ts.shot @@ -57,7 +57,7 @@ ScopeManager { identifier: Identifier<"T">, isRead: true, isTypeReference: true, - isValueReference: false, + isValueReference: true, isWrite: false, resolved: Variable$5, }, diff --git a/packages/scope-manager/tests/fixtures/class/emit-metadata/nested-class-outer.ts.shot b/packages/scope-manager/tests/fixtures/class/emit-metadata/nested-class-outer.ts.shot index 5db83db9116..e7a3a41761c 100644 --- a/packages/scope-manager/tests/fixtures/class/emit-metadata/nested-class-outer.ts.shot +++ b/packages/scope-manager/tests/fixtures/class/emit-metadata/nested-class-outer.ts.shot @@ -65,7 +65,7 @@ ScopeManager { identifier: Identifier<"T">, isRead: true, isTypeReference: true, - isValueReference: false, + isValueReference: true, isWrite: false, resolved: Variable$5, }, diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index f3b093dc2a7..a6a66c0d854 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -149,7 +149,6 @@ export class Converter { | ts.ModuleDeclaration, result: T, ): TSESTree.ExportDefaultDeclaration | TSESTree.ExportNamedDeclaration | T { - // check for exports const modifiers = getModifiers(node); if (modifiers?.[0].kind === SyntaxKind.ExportKeyword) { /** @@ -387,10 +386,9 @@ export class Converter { return parameters.map(param => { const convertedParam = this.convertChild(param) as TSESTree.Parameter; - const decorators = getDecorators(param); - if (decorators?.length) { - convertedParam.decorators = decorators.map(el => this.convertChild(el)); - } + convertedParam.decorators = + getDecorators(param)?.map(el => this.convertChild(el)) ?? []; + return convertedParam; }); } @@ -617,11 +615,19 @@ export class Converter { | ts.GetAccessorDeclaration | ts.SetAccessorDeclaration, ): TSESTree.TSMethodSignature { - const result = this.createNode(node, { + if (hasModifier(SyntaxKind.ExportKeyword, node)) { + throw createError( + this.ast, + node.pos, + 'A method signature cannot have an export modifier.', + ); + } + + return this.createNode(node, { type: AST_NODE_TYPES.TSMethodSignature, + accessibility: getTSNodeAccessibility(node), computed: isComputedProperty(node.name), key: this.convertChild(node.name), - params: this.convertParameters(node.parameters), kind: ((): 'get' | 'set' | 'method' => { switch (node.kind) { case SyntaxKind.GetAccessor: @@ -634,45 +640,17 @@ export class Converter { return 'method'; } })(), - }); - - if (isOptional(node)) { - result.optional = true; - } - - if (node.type) { - result.returnType = this.convertTypeAnnotation(node.type, node); - } - - if (hasModifier(SyntaxKind.ReadonlyKeyword, node)) { - result.readonly = true; - } - - if (node.typeParameters) { - result.typeParameters = + optional: isOptional(node), + params: this.convertParameters(node.parameters), + returnType: node.type && this.convertTypeAnnotation(node.type, node), + readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node), + static: hasModifier(SyntaxKind.StaticKeyword, node), + typeParameters: + node.typeParameters && this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters, - ); - } - - const accessibility = getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - - if (hasModifier(SyntaxKind.ExportKeyword, node)) { - throw createError( - this.ast, - node.pos, - 'A method signature cannot have an export modifier.', - ); - } - - if (hasModifier(SyntaxKind.StaticKeyword, node)) { - result.static = true; - } - - return result; + ), + }); } private convertAssertClasue( @@ -740,8 +718,10 @@ export class Converter { return this.createNode(node, { type: AST_NODE_TYPES.Program, body: this.convertBodyExpressions(node.statements, node), - sourceType: node.externalModuleIndicator ? 'module' : 'script', + comments: undefined, range: [node.getStart(this.ast), node.endOfFileToken.end], + sourceType: node.externalModuleIndicator ? 'module' : 'script', + tokens: undefined, }); } @@ -762,7 +742,10 @@ export class Converter { } return this.createNode(node, { type: AST_NODE_TYPES.Identifier, + decorators: [], name: node.text, + optional: false, + typeAnnotation: undefined, }); } @@ -926,38 +909,28 @@ export class Converter { isDeclare || !node.body ? AST_NODE_TYPES.TSDeclareFunction : AST_NODE_TYPES.FunctionDeclaration, - id: this.convertChild(node.name), - generator: !!node.asteriskToken, - expression: false, async: hasModifier(SyntaxKind.AsyncKeyword, node), - params: this.convertParameters(node.parameters), body: this.convertChild(node.body) || undefined, - }); - - // Process returnType - if (node.type) { - result.returnType = this.convertTypeAnnotation(node.type, node); - } - - // Process typeParameters - if (node.typeParameters) { - result.typeParameters = + declare: isDeclare, + expression: false, + generator: !!node.asteriskToken, + id: this.convertChild(node.name), + params: this.convertParameters(node.parameters), + returnType: node.type && this.convertTypeAnnotation(node.type, node), + typeParameters: + node.typeParameters && this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters, - ); - } - - if (isDeclare) { - result.declare = true; - } + ), + }); - // check for exports return this.fixExports(node, result); } case SyntaxKind.VariableDeclaration: { - const result = this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.VariableDeclarator, + definite: !!node.exclamationToken, id: this.convertBindingNameWithTypeAnnotation( node.name, node.type, @@ -965,12 +938,6 @@ export class Converter { ), init: this.convertChild(node.initializer), }); - - if (node.exclamationToken) { - result.definite = true; - } - - return result; } case SyntaxKind.VariableStatement: { @@ -979,6 +946,7 @@ export class Converter { declarations: node.declarationList.declarations.map(el => this.convertChild(el), ), + declare: hasModifier(SyntaxKind.DeclareKeyword, node), kind: getDeclarationKind(node.declarationList), }); @@ -989,12 +957,6 @@ export class Converter { * * So for consistency across versions, we no longer include it either. */ - - if (hasModifier(SyntaxKind.DeclareKeyword, node)) { - result.declare = true; - } - - // check for exports return this.fixExports(node, result); } @@ -1003,6 +965,7 @@ export class Converter { return this.createNode(node, { type: AST_NODE_TYPES.VariableDeclaration, declarations: node.declarations.map(el => this.convertChild(el)), + declare: false, kind: getDeclarationKind(node), }); @@ -1011,6 +974,7 @@ export class Converter { case SyntaxKind.ExpressionStatement: return this.createNode(node, { type: AST_NODE_TYPES.ExpressionStatement, + directive: undefined, expression: this.convertChild(node.expression), }); @@ -1024,7 +988,10 @@ export class Converter { if (this.allowPattern) { return this.createNode(node, { type: AST_NODE_TYPES.ArrayPattern, + decorators: [], elements: node.elements.map(el => this.convertPattern(el)), + optional: false, + typeAnnotation: undefined, }); } else { return this.createNode(node, { @@ -1039,7 +1006,10 @@ export class Converter { if (this.allowPattern) { return this.createNode(node, { type: AST_NODE_TYPES.ObjectPattern, + decorators: [], + optional: false, properties: node.properties.map(el => this.convertPattern(el)), + typeAnnotation: undefined, }); } else { return this.createNode(node, { @@ -1070,6 +1040,7 @@ export class Converter { value: this.converter(node.initializer, node, this.allowPattern), computed: isComputedProperty(node.name), method: false, + optional: false, shorthand: false, kind: 'init', }); @@ -1102,23 +1073,28 @@ export class Converter { key: this.convertChild(node.name), value: this.createNode(node, { type: AST_NODE_TYPES.AssignmentPattern, + decorators: [], left: this.convertPattern(node.name), + optional: false, right: this.convertChild(node.objectAssignmentInitializer), + typeAnnotation: undefined, }), computed: false, method: false, + optional: false, shorthand: true, kind: 'init', }); } else { return this.createNode(node, { type: AST_NODE_TYPES.Property, - key: this.convertChild(node.name), - value: this.convertChild(node.name), computed: false, + key: this.convertChild(node.name), + kind: 'init', method: false, + optional: false, shorthand: true, - kind: 'init', + value: this.convertChild(node.name), }); } } @@ -1145,53 +1121,36 @@ export class Converter { return AST_NODE_TYPES.PropertyDefinition; })(); - const result = this.createNode< + const key = this.convertChild(node.name); + + return this.createNode< | TSESTree.TSAbstractAccessorProperty | TSESTree.TSAbstractPropertyDefinition | TSESTree.PropertyDefinition | TSESTree.AccessorProperty >(node, { type, - key: this.convertChild(node.name), + key, + accessibility: getTSNodeAccessibility(node), value: isAbstract ? null : this.convertChild(node.initializer), computed: isComputedProperty(node.name), static: hasModifier(SyntaxKind.StaticKeyword, node), - readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, + readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node), + decorators: + getDecorators(node)?.map(el => this.convertChild(el)) ?? [], + declare: hasModifier(SyntaxKind.DeclareKeyword, node), override: hasModifier(SyntaxKind.OverrideKeyword, node), + typeAnnotation: + node.type && this.convertTypeAnnotation(node.type, node), + optional: + (key.type === AST_NODE_TYPES.Literal || + node.name.kind === SyntaxKind.Identifier || + node.name.kind === SyntaxKind.ComputedPropertyName || + node.name.kind === SyntaxKind.PrivateIdentifier) && + !!node.questionToken, + definite: !!node.exclamationToken, }); - - if (node.type) { - result.typeAnnotation = this.convertTypeAnnotation(node.type, node); - } - - const decorators = getDecorators(node); - if (decorators) { - result.decorators = decorators.map(el => this.convertChild(el)); - } - - const accessibility = getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - - if ( - (node.name.kind === SyntaxKind.Identifier || - node.name.kind === SyntaxKind.ComputedPropertyName || - node.name.kind === SyntaxKind.PrivateIdentifier) && - node.questionToken - ) { - result.optional = true; - } - - if (node.exclamationToken) { - result.definite = true; - } - - if (result.key.type === AST_NODE_TYPES.Literal && node.questionToken) { - result.optional = true; - } - return result; } case SyntaxKind.GetAccessor: @@ -1216,20 +1175,18 @@ export class Converter { expression: false, // ESTreeNode as ESTreeNode here async: hasModifier(SyntaxKind.AsyncKeyword, node), body: this.convertChild(node.body), + declare: false, range: [node.parameters.pos - 1, node.end], params: [], - }); - - if (node.type) { - method.returnType = this.convertTypeAnnotation(node.type, node); - } - - // Process typeParameters - if (node.typeParameters) { - method.typeParameters = + returnType: node.type && this.convertTypeAnnotation(node.type, node), + typeParameters: + node.typeParameters && this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters, - ); + ), + }); + + if (method.typeParameters) { this.fixParentLocation(method, method.typeParameters.range); } @@ -1246,6 +1203,7 @@ export class Converter { key: this.convertChild(node.name), value: method, computed: isComputedProperty(node.name), + optional: !!node.questionToken, method: node.kind === SyntaxKind.MethodDeclaration, shorthand: false, kind: 'init', @@ -1272,27 +1230,17 @@ export class Converter { TSESTree.TSAbstractMethodDefinition | TSESTree.MethodDefinition >(node, { type: methodDefinitionType, - key: this.convertChild(node.name), - value: method, + accessibility: getTSNodeAccessibility(node), computed: isComputedProperty(node.name), - static: hasModifier(SyntaxKind.StaticKeyword, node), + decorators: + getDecorators(node)?.map(el => this.convertChild(el)) ?? [], + key: this.convertChild(node.name), kind: 'method', + optional: !!node.questionToken, override: hasModifier(SyntaxKind.OverrideKeyword, node), + static: hasModifier(SyntaxKind.StaticKeyword, node), + value: method, }); - - const decorators = getDecorators(node); - if (decorators) { - result.decorators = decorators.map(el => this.convertChild(el)); - } - - const accessibility = getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - } - - if (node.questionToken) { - result.optional = true; } if (node.kind === SyntaxKind.GetAccessor) { @@ -1323,82 +1271,72 @@ export class Converter { type: !node.body ? AST_NODE_TYPES.TSEmptyBodyFunctionExpression : AST_NODE_TYPES.FunctionExpression, - id: null, - params: this.convertParameters(node.parameters), - generator: false, - expression: false, // is not present in ESTreeNode async: false, body: this.convertChild(node.body), + declare: false, + expression: false, // is not present in ESTreeNode + generator: false, + id: null, + params: this.convertParameters(node.parameters), range: [node.parameters.pos - 1, node.end], - }); - - // Process typeParameters - if (node.typeParameters) { - constructor.typeParameters = + returnType: node.type && this.convertTypeAnnotation(node.type, node), + typeParameters: + node.typeParameters && this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters, - ); - this.fixParentLocation(constructor, constructor.typeParameters.range); - } + ), + }); - // Process returnType - if (node.type) { - constructor.returnType = this.convertTypeAnnotation(node.type, node); + if (constructor.typeParameters) { + this.fixParentLocation(constructor, constructor.typeParameters.range); } const constructorKey = this.createNode(node, { type: AST_NODE_TYPES.Identifier, + decorators: [], name: 'constructor', + optional: false, range: [constructorToken.getStart(this.ast), constructorToken.end], + typeAnnotation: undefined, }); const isStatic = hasModifier(SyntaxKind.StaticKeyword, node); - const result = this.createNode< + + return this.createNode< TSESTree.TSAbstractMethodDefinition | TSESTree.MethodDefinition >(node, { type: hasModifier(SyntaxKind.AbstractKeyword, node) ? AST_NODE_TYPES.TSAbstractMethodDefinition : AST_NODE_TYPES.MethodDefinition, - key: constructorKey, - value: constructor, + accessibility: getTSNodeAccessibility(node), computed: false, - static: isStatic, + decorators: [], + optional: false, + key: constructorKey, kind: isStatic ? 'method' : 'constructor', override: false, + static: isStatic, + value: constructor, }); - - const accessibility = getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - - return result; } case SyntaxKind.FunctionExpression: { - const result = this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.FunctionExpression, - id: this.convertChild(node.name), - generator: !!node.asteriskToken, - params: this.convertParameters(node.parameters), - body: this.convertChild(node.body), async: hasModifier(SyntaxKind.AsyncKeyword, node), + body: this.convertChild(node.body), + declare: false, expression: false, - }); - - // Process returnType - if (node.type) { - result.returnType = this.convertTypeAnnotation(node.type, node); - } - - // Process typeParameters - if (node.typeParameters) { - result.typeParameters = + generator: !!node.asteriskToken, + id: this.convertChild(node.name), + params: this.convertParameters(node.parameters), + returnType: node.type && this.convertTypeAnnotation(node.type, node), + typeParameters: + node.typeParameters && this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters, - ); - } - return result; + ), + }); } case SyntaxKind.SuperKeyword: @@ -1409,7 +1347,10 @@ export class Converter { case SyntaxKind.ArrayBindingPattern: return this.createNode(node, { type: AST_NODE_TYPES.ArrayPattern, + decorators: [], elements: node.elements.map(el => this.convertPattern(el)), + optional: false, + typeAnnotation: undefined, }); // occurs with missing array elements like [,] @@ -1419,7 +1360,10 @@ export class Converter { case SyntaxKind.ObjectBindingPattern: return this.createNode(node, { type: AST_NODE_TYPES.ObjectPattern, + decorators: [], + optional: false, properties: node.elements.map(el => this.convertPattern(el)), + typeAnnotation: undefined, }); case SyntaxKind.BindingElement: { @@ -1429,13 +1373,20 @@ export class Converter { if (node.initializer) { return this.createNode(node, { type: AST_NODE_TYPES.AssignmentPattern, + decorators: [], left: arrayItem, + optional: false, right: this.convertChild(node.initializer), + typeAnnotation: undefined, }); } else if (node.dotDotDotToken) { return this.createNode(node, { type: AST_NODE_TYPES.RestElement, argument: arrayItem, + decorators: [], + optional: false, + typeAnnotation: undefined, + value: undefined, }); } else { return arrayItem; @@ -1446,6 +1397,10 @@ export class Converter { result = this.createNode(node, { type: AST_NODE_TYPES.RestElement, argument: this.convertChild(node.propertyName ?? node.name), + decorators: [], + optional: false, + typeAnnotation: undefined, + value: undefined, }); } else { result = this.createNode(node, { @@ -1457,6 +1412,7 @@ export class Converter { node.propertyName.kind === SyntaxKind.ComputedPropertyName, ), method: false, + optional: false, shorthand: !node.propertyName, kind: 'init', }); @@ -1465,9 +1421,12 @@ export class Converter { if (node.initializer) { result.value = this.createNode(node, { type: AST_NODE_TYPES.AssignmentPattern, + decorators: [], left: this.convertChild(node.name), - right: this.convertChild(node.initializer), + optional: false, range: [node.name.getStart(this.ast), node.initializer.end], + right: this.convertChild(node.initializer), + typeAnnotation: undefined, }); } return result; @@ -1475,7 +1434,7 @@ export class Converter { } case SyntaxKind.ArrowFunction: { - const result = this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.ArrowFunctionExpression, generator: false, id: null, @@ -1483,21 +1442,13 @@ export class Converter { body: this.convertChild(node.body), async: hasModifier(SyntaxKind.AsyncKeyword, node), expression: node.body.kind !== SyntaxKind.Block, - }); - - // Process returnType - if (node.type) { - result.returnType = this.convertTypeAnnotation(node.type, node); - } - - // Process typeParameters - if (node.typeParameters) { - result.typeParameters = + returnType: node.type && this.convertTypeAnnotation(node.type, node), + typeParameters: + node.typeParameters && this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters, - ); - } - return result; + ), + }); } case SyntaxKind.YieldExpression: @@ -1593,6 +1544,10 @@ export class Converter { return this.createNode(node, { type: AST_NODE_TYPES.RestElement, argument: this.convertPattern(node.expression), + decorators: [], + optional: false, + typeAnnotation: undefined, + value: undefined, }); } else { return this.createNode(node, { @@ -1610,13 +1565,20 @@ export class Converter { parameter = result = this.createNode(node, { type: AST_NODE_TYPES.RestElement, argument: this.convertChild(node.name), + decorators: [], + optional: false, + typeAnnotation: undefined, + value: undefined, }); } else if (node.initializer) { parameter = this.convertChild(node.name) as TSESTree.BindingName; result = this.createNode(node, { type: AST_NODE_TYPES.AssignmentPattern, + decorators: [], left: parameter, + optional: false, right: this.convertChild(node.initializer), + typeAnnotation: undefined, }); const modifiers = getModifiers(node); @@ -1660,13 +1622,12 @@ export class Converter { return this.createNode(node, { type: AST_NODE_TYPES.TSParameterProperty, - accessibility: getTSNodeAccessibility(node) ?? undefined, - readonly: - hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, - static: hasModifier(SyntaxKind.StaticKeyword, node) || undefined, - override: - hasModifier(SyntaxKind.OverrideKeyword, node) || undefined, + accessibility: getTSNodeAccessibility(node), + decorators: [], + override: hasModifier(SyntaxKind.OverrideKeyword, node), parameter: result, + readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node), + static: hasModifier(SyntaxKind.StaticKeyword, node), }); } return result; @@ -1686,6 +1647,14 @@ export class Converter { clause => clause.token === SyntaxKind.ExtendsKeyword, ); + if (superClass?.types && superClass.types.length > 1) { + throw createError( + this.ast, + superClass.types[1].pos, + 'Classes can only extend a single class.', + ); + } + const implementsClause = heritageClauses.find( clause => clause.token === SyntaxKind.ImplementsKeyword, ); @@ -1694,15 +1663,30 @@ export class Converter { TSESTree.ClassDeclaration | TSESTree.ClassExpression >(node, { type: classNodeType, - id: this.convertChild(node.name), + abstract: hasModifier(SyntaxKind.AbstractKeyword, node), body: this.createNode(node, { type: AST_NODE_TYPES.ClassBody, - body: [], + body: node.members + .filter(isESTreeClassMember) + .map(el => this.convertChild(el)), range: [node.members.pos - 1, node.end], }), + declare: hasModifier(SyntaxKind.DeclareKeyword, node), + decorators: + getDecorators(node)?.map(el => this.convertChild(el)) ?? [], + id: this.convertChild(node.name), + implements: + implementsClause?.types.map(el => this.convertChild(el)) ?? [], superClass: superClass?.types[0] ? this.convertChild(superClass.types[0].expression) : null, + superTypeArguments: undefined, + superTypeParameters: undefined, + typeParameters: + node.typeParameters && + this.convertTSTypeParametersToTypeParametersDeclaration( + node.typeParameters, + ), }); if (superClass) { @@ -1724,42 +1708,6 @@ export class Converter { } } - if (node.typeParameters) { - result.typeParameters = - this.convertTSTypeParametersToTypeParametersDeclaration( - node.typeParameters, - ); - } - - if (implementsClause) { - result.implements = implementsClause.types.map(el => - this.convertChild(el), - ); - } - - /** - * TypeScript class declarations can be defined as "abstract" - */ - if (hasModifier(SyntaxKind.AbstractKeyword, node)) { - result.abstract = true; - } - - if (hasModifier(SyntaxKind.DeclareKeyword, node)) { - result.declare = true; - } - - const decorators = getDecorators(node); - if (decorators) { - result.decorators = decorators.map(el => this.convertChild(el)); - } - - const filteredMembers = node.members.filter(isESTreeClassMember); - - if (filteredMembers.length) { - result.body.body = filteredMembers.map(el => this.convertChild(el)); - } - - // check for exports return this.fixExports(node, result); } @@ -1980,8 +1928,11 @@ export class Converter { ) { return this.createNode(node, { type: AST_NODE_TYPES.AssignmentPattern, + decorators: [], left: this.convertPattern(node.left, node), + optional: false, right: this.convertChild(node.right), + typeAnnotation: undefined, }); } return this.createNode< @@ -2053,44 +2004,43 @@ export class Converter { const callee = this.convertChild(node.expression); const args = node.arguments.map(el => this.convertChild(el)); + const typeArguments = + node.typeArguments && + this.convertTypeArgumentsToTypeParameterInstantiation( + node.typeArguments, + node, + ); const result = this.createNode(node, { type: AST_NODE_TYPES.CallExpression, callee, arguments: args, optional: node.questionDotToken !== undefined, + typeArguments, + typeParameters: typeArguments, }); - if (node.typeArguments) { - // eslint-disable-next-line deprecation/deprecation - result.typeArguments = result.typeParameters = - this.convertTypeArgumentsToTypeParameterInstantiation( - node.typeArguments, - node, - ); - } - return this.convertChainExpression(result, node); } case SyntaxKind.NewExpression: { + const typeArguments = + node.typeArguments && + this.convertTypeArgumentsToTypeParameterInstantiation( + node.typeArguments, + node, + ); + // NOTE - NewExpression cannot have an optional chain in it - const result = this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.NewExpression, - callee: this.convertChild(node.expression), arguments: node.arguments ? node.arguments.map(el => this.convertChild(el)) : [], + callee: this.convertChild(node.expression), + typeArguments, + typeParameters: typeArguments, }); - if (node.typeArguments) { - // eslint-disable-next-line deprecation/deprecation - result.typeArguments = result.typeParameters = - this.convertTypeArgumentsToTypeParameterInstantiation( - node.typeArguments, - node, - ); - } - return result; } case SyntaxKind.ConditionalExpression: @@ -2109,7 +2059,10 @@ export class Converter { node.getFirstToken()! as ts.Token, { type: AST_NODE_TYPES.Identifier, + decorators: [], name: getTextForTokenKind(node.keywordToken), + optional: false, + typeAnnotation: undefined, }, ), property: this.convertChild(node.name), @@ -2170,8 +2123,8 @@ export class Converter { let regex = null; try { regex = new RegExp(pattern, flags); - } catch (exception: unknown) { - regex = null; + } catch { + // Intentionally blank, so regex stays null } return this.createNode(node, { @@ -2264,21 +2217,25 @@ export class Converter { }); } - case SyntaxKind.JsxOpeningElement: + case SyntaxKind.JsxOpeningElement: { + const typeArguments = + node.typeArguments && + this.convertTypeArgumentsToTypeParameterInstantiation( + node.typeArguments, + node, + ); + return this.createNode(node, { type: AST_NODE_TYPES.JSXOpeningElement, - typeArguments: node.typeArguments - ? this.convertTypeArgumentsToTypeParameterInstantiation( - node.typeArguments, - node, - ) - : undefined, + typeArguments, + typeParameters: typeArguments, selfClosing: false, name: this.convertJSXTagName(node.tagName, node), attributes: node.attributes.properties.map(el => this.convertChild(el), ), }); + } case SyntaxKind.JsxClosingElement: return this.createNode(node, { @@ -2373,9 +2330,7 @@ export class Converter { return this.createNode(node, { type: AST_NODE_TYPES.TSTypeParameter, name: this.convertChild(node.name), - constraint: node.constraint - ? this.convertChild(node.constraint) - : undefined, + constraint: node.constraint && this.convertChild(node.constraint), default: node.default ? this.convertChild(node.default) : undefined, in: hasModifier(SyntaxKind.InKeyword, node), out: hasModifier(SyntaxKind.OutKeyword, node), @@ -2461,32 +2416,20 @@ export class Converter { } case SyntaxKind.MappedType: { - const result = this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSMappedType, - typeParameter: this.convertChild(node.typeParameter), nameType: this.convertChild(node.nameType) ?? null, + optional: + node.questionToken && + (node.questionToken.kind === SyntaxKind.QuestionToken || + getTextForTokenKind(node.questionToken.kind)), + readonly: + node.readonlyToken && + (node.readonlyToken.kind === SyntaxKind.ReadonlyKeyword || + getTextForTokenKind(node.readonlyToken.kind)), + typeAnnotation: node.type && this.convertChild(node.type), + typeParameter: this.convertChild(node.typeParameter), }); - - if (node.readonlyToken) { - if (node.readonlyToken.kind === SyntaxKind.ReadonlyKeyword) { - result.readonly = true; - } else { - result.readonly = getTextForTokenKind(node.readonlyToken.kind); - } - } - - if (node.questionToken) { - if (node.questionToken.kind === SyntaxKind.QuestionToken) { - result.optional = true; - } else { - result.optional = getTextForTokenKind(node.questionToken.kind); - } - } - - if (node.type) { - result.typeAnnotation = this.convertChild(node.type); - } - return result; } case SyntaxKind.ParenthesizedExpression: @@ -2495,23 +2438,16 @@ export class Converter { case SyntaxKind.TypeAliasDeclaration: { const result = this.createNode(node, { type: AST_NODE_TYPES.TSTypeAliasDeclaration, + declare: hasModifier(SyntaxKind.DeclareKeyword, node), id: this.convertChild(node.name), typeAnnotation: this.convertChild(node.type), - }); - - if (hasModifier(SyntaxKind.DeclareKeyword, node)) { - result.declare = true; - } - - // Process typeParameters - if (node.typeParameters) { - result.typeParameters = + typeParameters: + node.typeParameters && this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters, - ); - } + ), + }); - // check for exports return this.fixExports(node, result); } @@ -2535,45 +2471,20 @@ export class Converter { ); } - const result = this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSPropertySignature, - optional: isOptional(node) || undefined, + accessibility: getTSNodeAccessibility(node), computed: isComputedProperty(node.name), key: this.convertChild(node.name), - typeAnnotation: node.type - ? this.convertTypeAnnotation(node.type, node) - : undefined, - readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node) || undefined, - static: hasModifier(SyntaxKind.StaticKeyword, node) || undefined, + optional: isOptional(node), + readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node), + static: hasModifier(SyntaxKind.StaticKeyword, node), + typeAnnotation: + node.type && this.convertTypeAnnotation(node.type, node), }); - - const accessibility = getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - - return result; } case SyntaxKind.IndexSignature: { - const result = this.createNode(node, { - type: AST_NODE_TYPES.TSIndexSignature, - parameters: node.parameters.map(el => this.convertChild(el)), - }); - - if (node.type) { - result.typeAnnotation = this.convertTypeAnnotation(node.type, node); - } - - if (hasModifier(SyntaxKind.ReadonlyKeyword, node)) { - result.readonly = true; - } - - const accessibility = getTSNodeAccessibility(node); - if (accessibility) { - result.accessibility = accessibility; - } - if (hasModifier(SyntaxKind.ExportKeyword, node)) { throw createError( this.ast, @@ -2582,27 +2493,29 @@ export class Converter { ); } - if (hasModifier(SyntaxKind.StaticKeyword, node)) { - result.static = true; - } - return result; + return this.createNode(node, { + type: AST_NODE_TYPES.TSIndexSignature, + accessibility: getTSNodeAccessibility(node), + parameters: node.parameters.map(el => this.convertChild(el)), + readonly: hasModifier(SyntaxKind.ReadonlyKeyword, node), + static: hasModifier(SyntaxKind.StaticKeyword, node), + typeAnnotation: + node.type && this.convertTypeAnnotation(node.type, node), + }); } + case SyntaxKind.ConstructorType: { - const result = this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSConstructorType, - params: this.convertParameters(node.parameters), abstract: hasModifier(SyntaxKind.AbstractKeyword, node), - }); - if (node.type) { - result.returnType = this.convertTypeAnnotation(node.type, node); - } - if (node.typeParameters) { - result.typeParameters = + params: this.convertParameters(node.parameters), + returnType: node.type && this.convertTypeAnnotation(node.type, node), + typeParameters: + node.typeParameters && this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters, - ); - } - return result; + ), + }); } case SyntaxKind.FunctionType: @@ -2621,25 +2534,21 @@ export class Converter { : node.kind === SyntaxKind.CallSignature ? AST_NODE_TYPES.TSCallSignatureDeclaration : AST_NODE_TYPES.TSFunctionType; - const result = this.createNode< + + return this.createNode< | TSESTree.TSFunctionType | TSESTree.TSCallSignatureDeclaration | TSESTree.TSConstructSignatureDeclaration >(node, { - type: type, + type, params: this.convertParameters(node.parameters), - }); - if (node.type) { - result.returnType = this.convertTypeAnnotation(node.type, node); - } - - if (node.typeParameters) { - result.typeParameters = + returnType: node.type && this.convertTypeAnnotation(node.type, node), + typeParameters: + node.typeParameters && this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters, - ); - } - return result; + ), + }); } case SyntaxKind.ExpressionWithTypeArguments: { @@ -2650,6 +2559,14 @@ export class Converter { : parentKind === SyntaxKind.HeritageClause ? AST_NODE_TYPES.TSClassImplements : AST_NODE_TYPES.TSInstantiationExpression; + + const typeArguments = + node.typeArguments && + this.convertTypeArgumentsToTypeParameterInstantiation( + node.typeArguments, + node, + ); + const result = this.createNode< | TSESTree.TSInterfaceHeritage | TSESTree.TSClassImplements @@ -2657,16 +2574,10 @@ export class Converter { >(node, { type, expression: this.convertChild(node.expression), + typeArguments, + typeParameters: typeArguments, }); - if (node.typeArguments) { - // eslint-disable-next-line deprecation/deprecation - result.typeArguments = result.typeParameters = - this.convertTypeArgumentsToTypeParameterInstantiation( - node.typeArguments, - node, - ); - } return result; } @@ -2679,38 +2590,26 @@ export class Converter { body: node.members.map(member => this.convertChild(member)), range: [node.members.pos - 1, node.end], }), - id: this.convertChild(node.name), - }); + declare: hasModifier(SyntaxKind.DeclareKeyword, node), + extends: interfaceHeritageClauses + .filter( + heritageClause => + heritageClause.token === SyntaxKind.ExtendsKeyword, + ) + .flatMap(heritageClause => + heritageClause.types.map( + n => this.convertChild(n, node) as TSESTree.TSInterfaceHeritage, + ), + ), - if (node.typeParameters) { - result.typeParameters = + id: this.convertChild(node.name), + typeParameters: + node.typeParameters && this.convertTSTypeParametersToTypeParametersDeclaration( node.typeParameters, - ); - } - - if (interfaceHeritageClauses.length > 0) { - const interfaceExtends: TSESTree.TSInterfaceHeritage[] = []; - - for (const heritageClause of interfaceHeritageClauses) { - if (heritageClause.token === SyntaxKind.ExtendsKeyword) { - for (const n of heritageClause.types) { - interfaceExtends.push( - this.convertChild(n, node) as TSESTree.TSInterfaceHeritage, - ); - } - } - } - - if (interfaceExtends.length > 0) { - result.extends = interfaceExtends; - } - } + ), + }); - if (hasModifier(SyntaxKind.DeclareKeyword, node)) { - result.declare = true; - } - // check for exports return this.fixExports(node, result); } @@ -2757,6 +2656,8 @@ export class Converter { return this.createNode(node, { type: AST_NODE_TYPES.TSTypeQuery, exprName: result, + typeArguments: undefined, + typeParameters: undefined, }); } return result; @@ -2765,34 +2666,22 @@ export class Converter { case SyntaxKind.EnumDeclaration: { const result = this.createNode(node, { type: AST_NODE_TYPES.TSEnumDeclaration, + const: hasModifier(SyntaxKind.ConstKeyword, node), + declare: hasModifier(SyntaxKind.DeclareKeyword, node), id: this.convertChild(node.name), members: node.members.map(el => this.convertChild(el)), }); - // apply modifiers first... - if (hasModifier(SyntaxKind.DeclareKeyword, node)) { - result.declare = true; - } - if (hasModifier(SyntaxKind.ConstKeyword, node)) { - result.const = true; - } - - // ...then check for exports return this.fixExports(node, result); } case SyntaxKind.EnumMember: { - const result = this.createNode(node, { + return this.createNode(node, { type: AST_NODE_TYPES.TSEnumMember, + computed: node.name.kind === ts.SyntaxKind.ComputedPropertyName, id: this.convertChild(node.name), + initializer: node.initializer && this.convertChild(node.initializer), }); - if (node.initializer) { - result.initializer = this.convertChild(node.initializer); - } - if (node.name.kind === ts.SyntaxKind.ComputedPropertyName) { - result.computed = true; - } - return result; } case SyntaxKind.ModuleDeclaration: { @@ -2826,6 +2715,8 @@ export class Converter { return { kind: 'global', body, + declare: false, + global: false, id, }; } @@ -2837,6 +2728,8 @@ export class Converter { return { kind: 'module', ...(body != null ? { body } : {}), + declare: false, + global: false, id: this.convertChild(node.name), }; } @@ -2854,9 +2747,12 @@ export class Converter { let name: TSESTree.Identifier | TSESTree.TSQualifiedName = this.createNode(node.name, { + decorators: [], name: node.name.text, + optional: false, range: [node.name.getStart(this.ast), node.name.getEnd()], type: AST_NODE_TYPES.Identifier, + typeAnnotation: undefined, }); while ( @@ -2869,9 +2765,12 @@ export class Converter { const nextName = node.name as ts.Identifier; const right = this.createNode(nextName, { + decorators: [], name: nextName.text, + optional: false, range: [nextName.getStart(this.ast), nextName.getEnd()], type: AST_NODE_TYPES.Identifier, + typeAnnotation: undefined, }); name = this.createNode(nextName, { @@ -2885,6 +2784,8 @@ export class Converter { return { kind: 'namespace', body: this.convertChild(node.body), + declare: false, + global: false, id: name, }; })(), diff --git a/packages/typescript-estree/src/node-utils.ts b/packages/typescript-estree/src/node-utils.ts index 929d63cfcdf..22d3772974a 100644 --- a/packages/typescript-estree/src/node-utils.ts +++ b/packages/typescript-estree/src/node-utils.ts @@ -275,10 +275,10 @@ export function getDeclarationKind( */ export function getTSNodeAccessibility( node: ts.Node, -): 'public' | 'protected' | 'private' | null { +): 'public' | 'protected' | 'private' | undefined { const modifiers = getModifiers(node); if (modifiers == null) { - return null; + return undefined; } for (const modifier of modifiers) { switch (modifier.kind) { @@ -292,7 +292,7 @@ export function getTSNodeAccessibility( break; } } - return null; + return undefined; } /** diff --git a/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap index 4439ae36ee0..2716f516148 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap @@ -61,9 +61,11 @@ exports[`convert deeplyCopy should convert array of nodes 1`] = ` "setExternalModuleIndicator": [Function], "statements": [ { + "directive": undefined, "expression": { "arguments": [], "callee": { + "decorators": [], "loc": { "end": { "column": 7, @@ -75,11 +77,13 @@ exports[`convert deeplyCopy should convert array of nodes 1`] = ` }, }, "name": "foo", + "optional": false, "range": [ 4, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": { "end": { @@ -126,6 +130,7 @@ exports[`convert deeplyCopy should convert array of nodes 1`] = ` "type": "TSTypeReference", "typeArguments": undefined, "typeName": { + "decorators": [], "loc": { "end": { "column": 9, @@ -137,11 +142,13 @@ exports[`convert deeplyCopy should convert array of nodes 1`] = ` }, }, "name": "T", + "optional": false, "range": [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -182,6 +189,7 @@ exports[`convert deeplyCopy should convert array of nodes 1`] = ` "type": "TSTypeReference", "typeArguments": undefined, "typeName": { + "decorators": [], "loc": { "end": { "column": 9, @@ -193,11 +201,13 @@ exports[`convert deeplyCopy should convert array of nodes 1`] = ` }, }, "name": "T", + "optional": false, "range": [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -274,6 +284,7 @@ exports[`convert deeplyCopy should convert node correctly 1`] = ` "typeParameters": null, }, ], + "comments": undefined, "loc": { "end": { "column": 35, @@ -289,6 +300,7 @@ exports[`convert deeplyCopy should convert node correctly 1`] = ` 35, ], "sourceType": "script", + "tokens": undefined, "type": "Program", } `; @@ -298,6 +310,7 @@ exports[`convert deeplyCopy should convert node with decorators correctly 1`] = "decorators": [ { "expression": { + "decorators": [], "loc": { "end": { "column": 5, @@ -309,11 +322,13 @@ exports[`convert deeplyCopy should convert node with decorators correctly 1`] = }, }, "name": "test", + "optional": false, "range": [ 1, 5, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": { "end": { @@ -344,6 +359,7 @@ exports[`convert deeplyCopy should convert node with decorators correctly 1`] = }, "members": [], "name": { + "decorators": [], "loc": { "end": { "column": 15, @@ -355,11 +371,13 @@ exports[`convert deeplyCopy should convert node with decorators correctly 1`] = }, }, "name": "foo", + "optional": false, "range": [ 12, 15, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": [ 0, @@ -374,6 +392,7 @@ exports[`convert deeplyCopy should convert node with type arguments correctly 1` { "arguments": [], "expression": { + "decorators": [], "loc": { "end": { "column": 7, @@ -385,11 +404,13 @@ exports[`convert deeplyCopy should convert node with type arguments correctly 1` }, }, "name": "foo", + "optional": false, "range": [ 4, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "loc": { "end": { @@ -436,6 +457,7 @@ exports[`convert deeplyCopy should convert node with type arguments correctly 1` "type": "TSTypeReference", "typeArguments": undefined, "typeName": { + "decorators": [], "loc": { "end": { "column": 9, @@ -447,11 +469,13 @@ exports[`convert deeplyCopy should convert node with type arguments correctly 1` }, }, "name": "T", + "optional": false, "range": [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -492,6 +516,7 @@ exports[`convert deeplyCopy should convert node with type arguments correctly 1` "type": "TSTypeReference", "typeArguments": undefined, "typeName": { + "decorators": [], "loc": { "end": { "column": 9, @@ -503,11 +528,13 @@ exports[`convert deeplyCopy should convert node with type arguments correctly 1` }, }, "name": "T", + "optional": false, "range": [ 8, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "typeParameters": undefined, }, @@ -535,6 +562,7 @@ exports[`convert deeplyCopy should convert node with type parameters correctly 1 }, "members": [], "name": { + "decorators": [], "loc": { "end": { "column": 9, @@ -546,11 +574,13 @@ exports[`convert deeplyCopy should convert node with type parameters correctly 1 }, }, "name": "foo", + "optional": false, "range": [ 6, 9, ], "type": "Identifier", + "typeAnnotation": undefined, }, "range": [ 0, @@ -584,6 +614,7 @@ exports[`convert deeplyCopy should convert node with type parameters correctly 1 }, }, "name": { + "decorators": [], "loc": { "end": { "column": 11, @@ -595,11 +626,13 @@ exports[`convert deeplyCopy should convert node with type parameters correctly 1 }, }, "name": "T", + "optional": false, "range": [ 10, 11, ], "type": "Identifier", + "typeAnnotation": undefined, }, "out": false, "range": [ diff --git a/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap index 58d69423139..ba513da932c 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/parse.test.ts.snap @@ -89,7 +89,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -101,11 +103,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "children": [], @@ -182,6 +186,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -379,7 +384,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -391,11 +398,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "children": [], @@ -472,6 +481,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -669,7 +679,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - witho { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -681,11 +693,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - witho }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "loc": { @@ -723,6 +737,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - witho "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -848,7 +863,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - witho { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -860,11 +877,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - witho }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "loc": { @@ -902,6 +921,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .js file - witho "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -1025,6 +1045,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .json file - wit "ast": { "body": [ { + "directive": undefined, "expression": { "loc": { "end": { @@ -1070,6 +1091,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .json file - wit }, }, "method": false, + "optional": false, "range": [ 2, 8, @@ -1245,7 +1267,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -1257,11 +1281,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "children": [], @@ -1338,6 +1364,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -1535,7 +1562,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -1547,11 +1576,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "children": [], @@ -1628,6 +1659,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -1825,7 +1857,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -1837,11 +1871,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "loc": { @@ -1879,6 +1915,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -2004,7 +2041,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -2016,11 +2055,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "loc": { @@ -2058,6 +2099,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .jsx file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -2183,7 +2225,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .ts file - witho { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -2195,11 +2239,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .ts file - witho }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "loc": { @@ -2237,6 +2283,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .ts file - witho "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -2362,7 +2409,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .ts file - witho { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -2374,11 +2423,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .ts file - witho }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "loc": { @@ -2416,6 +2467,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .ts file - witho "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -2541,7 +2593,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -2553,11 +2607,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "children": [], @@ -2634,6 +2690,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -2831,7 +2888,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -2843,11 +2902,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "children": [], @@ -2924,6 +2985,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -3121,7 +3183,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -3133,11 +3197,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "loc": { @@ -3175,6 +3241,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -3300,7 +3367,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -3312,11 +3381,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "loc": { @@ -3354,6 +3425,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .tsx file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -3479,7 +3551,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -3491,11 +3565,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "children": [], @@ -3572,6 +3648,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -3769,7 +3846,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -3781,11 +3860,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "loc": { @@ -3823,6 +3904,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -3948,7 +4030,9 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -3960,11 +4044,13 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with }, }, "name": "x", + "optional": false, "range": [ 6, 7, ], "type": "Identifier", + "typeAnnotation": undefined, }, "init": { "loc": { @@ -4002,6 +4088,7 @@ exports[`parseAndGenerateServices isolated parsing should parse .vue file - with "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -4126,8 +4213,11 @@ exports[`parseWithNodeMaps() general output should not contain loc 1`] = ` { "declarations": [ { + "definite": false, "id": { + "decorators": [], "name": "foo", + "optional": false, "range": [ 4, 7, @@ -4135,7 +4225,9 @@ exports[`parseWithNodeMaps() general output should not contain loc 1`] = ` "type": "Identifier", }, "init": { + "decorators": [], "name": "bar", + "optional": false, "range": [ 10, 13, @@ -4149,6 +4241,7 @@ exports[`parseWithNodeMaps() general output should not contain loc 1`] = ` "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "range": [ 0, @@ -4172,7 +4265,9 @@ exports[`parseWithNodeMaps() general output should not contain range 1`] = ` { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -4184,9 +4279,11 @@ exports[`parseWithNodeMaps() general output should not contain range 1`] = ` }, }, "name": "foo", + "optional": false, "type": "Identifier", }, "init": { + "decorators": [], "loc": { "end": { "column": 13, @@ -4198,6 +4295,7 @@ exports[`parseWithNodeMaps() general output should not contain range 1`] = ` }, }, "name": "bar", + "optional": false, "type": "Identifier", }, "loc": { @@ -4213,6 +4311,7 @@ exports[`parseWithNodeMaps() general output should not contain range 1`] = ` "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": { "end": { @@ -4248,7 +4347,9 @@ exports[`parseWithNodeMaps() general output tokens, comments, locs, and ranges w { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -4260,6 +4361,7 @@ exports[`parseWithNodeMaps() general output tokens, comments, locs, and ranges w }, }, "name": "foo", + "optional": false, "range": [ 4, 7, @@ -4267,6 +4369,7 @@ exports[`parseWithNodeMaps() general output tokens, comments, locs, and ranges w "type": "Identifier", }, "init": { + "decorators": [], "loc": { "end": { "column": 13, @@ -4278,6 +4381,7 @@ exports[`parseWithNodeMaps() general output tokens, comments, locs, and ranges w }, }, "name": "bar", + "optional": false, "range": [ 10, 13, @@ -4301,6 +4405,7 @@ exports[`parseWithNodeMaps() general output tokens, comments, locs, and ranges w "type": "VariableDeclarator", }, ], + "declare": false, "kind": "let", "loc": { "end": { diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.test.ts.snap index 5f103cf99f9..0d94ba3a46b 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semanticInfo.test.ts.snap @@ -352,6 +352,7 @@ exports[`semanticInfo fixtures/import-file.src 1`] = ` }, }, "local": { + "decorators": [], "loc": { "end": { "column": 10, @@ -363,6 +364,7 @@ exports[`semanticInfo fixtures/import-file.src 1`] = ` }, }, "name": "arr", + "optional": false, "range": [ 7, 10, @@ -433,6 +435,7 @@ exports[`semanticInfo fixtures/import-file.src 1`] = ` }, }, "object": { + "decorators": [], "loc": { "end": { "column": 3, @@ -444,6 +447,7 @@ exports[`semanticInfo fixtures/import-file.src 1`] = ` }, }, "name": "arr", + "optional": false, "range": [ 37, 40, @@ -452,6 +456,7 @@ exports[`semanticInfo fixtures/import-file.src 1`] = ` }, "optional": false, "property": { + "decorators": [], "loc": { "end": { "column": 8, @@ -463,6 +468,7 @@ exports[`semanticInfo fixtures/import-file.src 1`] = ` }, }, "name": "push", + "optional": false, "range": [ 41, 45, @@ -789,7 +795,9 @@ exports[`semanticInfo fixtures/isolated-file.src 1`] = ` { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 7, @@ -801,6 +809,7 @@ exports[`semanticInfo fixtures/isolated-file.src 1`] = ` }, }, "name": "x", + "optional": false, "range": [ 6, 7, @@ -900,6 +909,7 @@ exports[`semanticInfo fixtures/isolated-file.src 1`] = ` "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -1144,7 +1154,9 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` { "declarations": [ { + "definite": false, "id": { + "decorators": [], "loc": { "end": { "column": 12, @@ -1156,6 +1168,7 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, }, "name": "binExp", + "optional": false, "range": [ 6, 12, @@ -1235,6 +1248,7 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` "type": "VariableDeclarator", }, ], + "declare": false, "kind": "const", "loc": { "end": { @@ -1253,11 +1267,14 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` "type": "VariableDeclaration", }, { + "abstract": false, "body": { "body": [ { "computed": true, "declare": false, + "decorators": [], + "definite": false, "key": { "loc": { "end": { @@ -1287,11 +1304,13 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` "line": 4, }, }, + "optional": false, "override": false, "range": [ 37, 54, ], + "readonly": false, "static": false, "type": "PropertyDefinition", "typeAnnotation": { @@ -1347,7 +1366,10 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` ], "type": "ClassBody", }, + "declare": false, + "decorators": [], "id": { + "decorators": [], "loc": { "end": { "column": 9, @@ -1359,12 +1381,14 @@ exports[`semanticInfo fixtures/non-existent-estree-nodes.src 1`] = ` }, }, "name": "Bar", + "optional": false, "range": [ 29, 32, ], "type": "Identifier", }, + "implements": [], "loc": { "end": { "column": 1, diff --git a/packages/typescript-estree/tests/lib/parse.test.ts b/packages/typescript-estree/tests/lib/parse.test.ts index e39bb1bb0a7..6e2adac8f87 100644 --- a/packages/typescript-estree/tests/lib/parse.test.ts +++ b/packages/typescript-estree/tests/lib/parse.test.ts @@ -101,6 +101,7 @@ describe('parseWithNodeMaps()', () => { { "body": [ { + "directive": undefined, "expression": { "raw": "1", "type": "Literal", @@ -109,7 +110,9 @@ describe('parseWithNodeMaps()', () => { "type": "ExpressionStatement", }, ], + "comments": undefined, "sourceType": "script", + "tokens": undefined, "type": "Program", } `); diff --git a/packages/typescript-estree/tests/snapshots/comments/block-trailing-comment.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/block-trailing-comment.src.js.shot new file mode 100644 index 00000000000..79f98905243 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/block-trailing-comment.src.js.shot @@ -0,0 +1,232 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments block-trailing-comment.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 6, + 10, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "BlockStatement", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 15, + 24, + ], + "type": "Line", + "value": "comment", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/comment-within-condition.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/comment-within-condition.src.js.shot new file mode 100644 index 00000000000..e8d9e1190da --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/comment-within-condition.src.js.shot @@ -0,0 +1,229 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments comment-within-condition.src 1`] = ` +Object { + "body": Array [ + Object { + "alternate": null, + "consequent": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 28, + 30, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 10, + 30, + ], + "test": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "IfStatement", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Block", + "value": " foo ", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 23, + ], + "type": "Block", + "value": " bar ", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 10, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "Keyword", + "value": "if", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/export-default-anonymous-class.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/export-default-anonymous-class.src.js.shot new file mode 100644 index 00000000000..f53fbf24d7b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/export-default-anonymous-class.src.js.shot @@ -0,0 +1,399 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments export-default-anonymous-class.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "name": "method1", + "optional": false, + "range": Array [ + 103, + 110, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 103, + 119, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 13, + "line": 8, + }, + }, + "range": Array [ + 112, + 119, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "params": Array [], + "range": Array [ + 110, + 119, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 57, + 121, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": null, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 51, + 121, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 36, + 121, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "type": "Block", + "value": "* + * this is anonymous class. + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 63, + 98, + ], + "type": "Block", + "value": "* + * this is method1. + ", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 11, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 36, + 122, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 43, + 50, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 51, + 56, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 103, + 110, + ], + "type": "Identifier", + "value": "method1", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 8, + }, + "start": Object { + "column": 12, + "line": 8, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 13, + "line": 8, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 118, + 119, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 10, + }, + }, + "range": Array [ + 120, + 121, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/jsdoc-comment.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsdoc-comment.src.js.shot new file mode 100644 index 00000000000..89327f903b6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/jsdoc-comment.src.js.shot @@ -0,0 +1,354 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments jsdoc-comment.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 130, + 133, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 123, + 134, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 117, + 136, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 108, + 111, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 112, + 115, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 99, + 136, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 98, + ], + "type": "Block", + "value": "* + * This is a function. + * @param {String} bar some string + * @returns {String} returns bar + ", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 99, + 137, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 99, + 107, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 108, + 111, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 112, + 115, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 123, + 129, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 130, + 133, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 133, + 134, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 135, + 136, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-attr-and-text-with-url.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-attr-and-text-with-url.src.js.shot new file mode 100644 index 00000000000..0dd1ca45457 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-attr-and-text-with-url.src.js.shot @@ -0,0 +1,559 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments jsx-attr-and-text-with-url.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "link", + "optional": false, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 61, + ], + "raw": "http://example.com", + "type": "JSXText", + "value": "http://example.com", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 63, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 63, + 64, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 61, + 65, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 65, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "href", + "range": Array [ + 17, + 21, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 17, + 42, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 42, + ], + "raw": "\\"http://example.com\\"", + "type": "Literal", + "value": "http://example.com", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 15, + 16, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 14, + 43, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 14, + 65, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 66, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 66, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 67, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 67, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 68, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "value": "link", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "JSXIdentifier", + "value": "href", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 42, + ], + "type": "JSXText", + "value": "\\"http://example.com\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 61, + ], + "type": "JSXText", + "value": "http://example.com", + }, + Object { + "loc": Object { + "end": Object { + "column": 62, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 63, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 63, + "line": 1, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 1, + }, + "start": Object { + "column": 64, + "line": 1, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 66, + "line": 1, + }, + "start": Object { + "column": 65, + "line": 1, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 67, + "line": 1, + }, + "start": Object { + "column": 66, + "line": 1, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-block-comment.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-block-comment.src.js.shot new file mode 100644 index 00000000000..76bf409f37b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-block-comment.src.js.shot @@ -0,0 +1,750 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments jsx-block-comment.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "pure", + "optional": false, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 47, + 60, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 61, + 72, + ], + "type": "JSXEmptyExpression", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 60, + 73, + ], + "type": "JSXExpressionContainer", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 73, + 82, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "name": "Foo", + "range": Array [ + 84, + 87, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 82, + 88, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "Foo", + "range": Array [ + 43, + 46, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 42, + 47, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 42, + 88, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 95, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 97, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 13, + 97, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 97, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 97, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 61, + 72, + ], + "type": "Block", + "value": "COMMENT", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 98, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "value": "pure", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 43, + 46, + ], + "type": "JSXIdentifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 47, + 60, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 73, + 82, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 84, + 87, + ], + "type": "JSXIdentifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 87, + 88, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-comment-after-jsx.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-comment-after-jsx.src.js.shot new file mode 100644 index 00000000000..1976fe78dcb --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-comment-after-jsx.src.js.shot @@ -0,0 +1,599 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments jsx-comment-after-jsx.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "pure", + "optional": false, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "Foo", + "range": Array [ + 49, + 52, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 47, + 53, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "Foo", + "range": Array [ + 43, + 46, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 42, + 47, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 42, + 53, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 67, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 69, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 13, + 69, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 69, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 69, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 54, + 60, + ], + "type": "Line", + "value": " Foo", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 70, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "value": "pure", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 43, + 46, + ], + "type": "JSXIdentifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 49, + 52, + ], + "type": "JSXIdentifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-comment-after-self-closing-jsx.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-comment-after-self-closing-jsx.src.js.shot new file mode 100644 index 00000000000..72fdcdbea63 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-comment-after-self-closing-jsx.src.js.shot @@ -0,0 +1,511 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments jsx-comment-after-self-closing-jsx.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "pure", + "optional": false, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "Foo", + "range": Array [ + 43, + 46, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 42, + 49, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 42, + 49, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 63, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 65, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 13, + 65, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 65, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 50, + 56, + ], + "type": "Line", + "value": " Foo", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 66, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "value": "pure", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 43, + 46, + ], + "type": "JSXIdentifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-generic-with-comment-in-tag.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-generic-with-comment-in-tag.src.js.shot new file mode 100644 index 00000000000..ea6c181c416 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-generic-with-comment-in-tag.src.js.shot @@ -0,0 +1,3732 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments jsx-generic-with-comment-in-tag.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "comp", + "optional": false, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 24, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 3, + }, + "start": Object { + "column": 38, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 40, + "line": 3, + }, + }, + "name": "Component", + "range": Array [ + 60, + 69, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 58, + 70, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 50, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "Component", + "range": Array [ + 25, + 34, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 24, + 58, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 34, + 42, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "range": Array [ + 24, + 70, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 50, + "line": 3, + }, + }, + "range": Array [ + 70, + 75, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 4, + }, + "start": Object { + "column": 42, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 4, + }, + "start": Object { + "column": 44, + "line": 4, + }, + }, + "name": "Component", + "range": Array [ + 115, + 124, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 113, + 125, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 54, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "name": "foo", + "range": Array [ + 94, + 97, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 94, + 97, + ], + "type": "JSXAttribute", + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "name": "Component", + "range": Array [ + 76, + 85, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 75, + 113, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 86, + 92, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 85, + 93, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "range": Array [ + 75, + 125, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 54, + "line": 4, + }, + }, + "range": Array [ + 125, + 130, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 42, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 5, + }, + "start": Object { + "column": 44, + "line": 5, + }, + }, + "name": "Component", + "range": Array [ + 170, + 179, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 168, + 180, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "name": "bar", + "range": Array [ + 164, + 167, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 164, + 167, + ], + "type": "JSXAttribute", + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "name": "Component", + "range": Array [ + 131, + 140, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 130, + 168, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 141, + 147, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 140, + 148, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "range": Array [ + 130, + 180, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 6, + }, + "start": Object { + "column": 54, + "line": 5, + }, + }, + "range": Array [ + 180, + 185, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 6, + }, + "start": Object { + "column": 46, + "line": 6, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 6, + }, + "start": Object { + "column": 48, + "line": 6, + }, + }, + "name": "Component", + "range": Array [ + 229, + 238, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 227, + 239, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 58, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "name": "foo", + "range": Array [ + 204, + 207, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 204, + 207, + ], + "type": "JSXAttribute", + "value": null, + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 6, + }, + "start": Object { + "column": 42, + "line": 6, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 6, + }, + "start": Object { + "column": 42, + "line": 6, + }, + }, + "name": "bar", + "range": Array [ + 223, + 226, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 223, + 226, + ], + "type": "JSXAttribute", + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 46, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "name": "Component", + "range": Array [ + 186, + 195, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 185, + 227, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 15, + "line": 6, + }, + }, + "range": Array [ + 196, + 202, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 195, + 203, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "range": Array [ + 185, + 239, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 8, + }, + "start": Object { + "column": 58, + "line": 6, + }, + }, + "range": Array [ + 239, + 245, + ], + "raw": " + + ", + "type": "JSXText", + "value": " + + ", + }, + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 10, + }, + "start": Object { + "column": 5, + "line": 10, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 10, + }, + "start": Object { + "column": 7, + "line": 10, + }, + }, + "name": "Component", + "range": Array [ + 289, + 298, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 287, + 299, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 5, + "line": 8, + }, + }, + "name": "Component", + "range": Array [ + 246, + 255, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 245, + 287, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 8, + }, + "start": Object { + "column": 14, + "line": 8, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 256, + 262, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 255, + 263, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "range": Array [ + 245, + 299, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 11, + }, + "start": Object { + "column": 17, + "line": 10, + }, + }, + "range": Array [ + 299, + 304, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 14, + }, + "start": Object { + "column": 5, + "line": 14, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 14, + }, + "start": Object { + "column": 7, + "line": 14, + }, + }, + "name": "Component", + "range": Array [ + 358, + 367, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 356, + 368, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 12, + }, + "start": Object { + "column": 6, + "line": 12, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 12, + }, + "start": Object { + "column": 6, + "line": 12, + }, + }, + "name": "foo", + "range": Array [ + 329, + 332, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 329, + 332, + ], + "type": "JSXAttribute", + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 11, + }, + "start": Object { + "column": 5, + "line": 11, + }, + }, + "name": "Component", + "range": Array [ + 305, + 314, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 304, + 356, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 11, + }, + "start": Object { + "column": 14, + "line": 11, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 11, + }, + "start": Object { + "column": 15, + "line": 11, + }, + }, + "range": Array [ + 315, + 321, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 314, + 322, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "range": Array [ + 304, + 368, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 15, + }, + "start": Object { + "column": 17, + "line": 14, + }, + }, + "range": Array [ + 368, + 373, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 18, + }, + "start": Object { + "column": 5, + "line": 18, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 18, + }, + "start": Object { + "column": 7, + "line": 18, + }, + }, + "name": "Component", + "range": Array [ + 427, + 436, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 425, + 437, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 18, + }, + "start": Object { + "column": 4, + "line": 15, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 17, + }, + "start": Object { + "column": 6, + "line": 17, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 17, + }, + "start": Object { + "column": 6, + "line": 17, + }, + }, + "name": "foo", + "range": Array [ + 416, + 419, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 416, + 419, + ], + "type": "JSXAttribute", + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 18, + }, + "start": Object { + "column": 4, + "line": 15, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 15, + }, + "start": Object { + "column": 5, + "line": 15, + }, + }, + "name": "Component", + "range": Array [ + 374, + 383, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 373, + 425, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 15, + }, + "start": Object { + "column": 14, + "line": 15, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 15, + }, + "start": Object { + "column": 15, + "line": 15, + }, + }, + "range": Array [ + 384, + 390, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 383, + 391, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "range": Array [ + 373, + 437, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 19, + }, + "start": Object { + "column": 17, + "line": 18, + }, + }, + "range": Array [ + 437, + 442, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 23, + }, + "start": Object { + "column": 5, + "line": 23, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 23, + }, + "start": Object { + "column": 7, + "line": 23, + }, + }, + "name": "Component", + "range": Array [ + 506, + 515, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 504, + 516, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 23, + }, + "start": Object { + "column": 4, + "line": 19, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 20, + }, + "start": Object { + "column": 6, + "line": 20, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 20, + }, + "start": Object { + "column": 6, + "line": 20, + }, + }, + "name": "foo", + "range": Array [ + 467, + 470, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 467, + 470, + ], + "type": "JSXAttribute", + "value": null, + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 22, + }, + "start": Object { + "column": 6, + "line": 22, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 22, + }, + "start": Object { + "column": 6, + "line": 22, + }, + }, + "name": "bar", + "range": Array [ + 495, + 498, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 495, + 498, + ], + "type": "JSXAttribute", + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 23, + }, + "start": Object { + "column": 4, + "line": 19, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 19, + }, + "start": Object { + "column": 5, + "line": 19, + }, + }, + "name": "Component", + "range": Array [ + 443, + 452, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 442, + 504, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 19, + }, + "start": Object { + "column": 14, + "line": 19, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 19, + }, + "start": Object { + "column": 15, + "line": 19, + }, + }, + "range": Array [ + 453, + 459, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 452, + 460, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "range": Array [ + 442, + 516, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 24, + }, + "start": Object { + "column": 17, + "line": 23, + }, + }, + "range": Array [ + 516, + 519, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + ], + "closingFragment": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 24, + }, + "start": Object { + "column": 2, + "line": 24, + }, + }, + "range": Array [ + 519, + 522, + ], + "type": "JSXClosingFragment", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 24, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "openingFragment": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 17, + 19, + ], + "type": "JSXOpeningFragment", + }, + "range": Array [ + 17, + 522, + ], + "type": "JSXFragment", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 25, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 524, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 2, + "line": 25, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 525, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 43, + 57, + ], + "type": "Block", + "value": " comment1 ", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 98, + 112, + ], + "type": "Block", + "value": " comment2 ", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 5, + }, + "start": Object { + "column": 23, + "line": 5, + }, + }, + "range": Array [ + 149, + 163, + ], + "type": "Block", + "value": " comment3 ", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 6, + }, + "start": Object { + "column": 27, + "line": 6, + }, + }, + "range": Array [ + 208, + 222, + ], + "type": "Block", + "value": " comment4 ", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 9, + }, + }, + "range": Array [ + 270, + 281, + ], + "type": "Line", + "value": " comment5", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 13, + }, + "start": Object { + "column": 6, + "line": 13, + }, + }, + "range": Array [ + 339, + 350, + ], + "type": "Line", + "value": " comment6", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 16, + }, + "start": Object { + "column": 6, + "line": 16, + }, + }, + "range": Array [ + 398, + 409, + ], + "type": "Line", + "value": " comment7", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 21, + }, + "start": Object { + "column": 6, + "line": 21, + }, + }, + "range": Array [ + 477, + 488, + ], + "type": "Line", + "value": " comment8", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 26, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 526, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "value": "comp", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 25, + 34, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 3, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 38, + "line": 3, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 40, + "line": 3, + }, + }, + "range": Array [ + 60, + 69, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 3, + }, + "start": Object { + "column": 49, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 50, + "line": 3, + }, + }, + "range": Array [ + 70, + 75, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 76, + 85, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 86, + 92, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 94, + 97, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 41, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 4, + }, + "start": Object { + "column": 42, + "line": 4, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 4, + }, + "start": Object { + "column": 43, + "line": 4, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 4, + }, + "start": Object { + "column": 44, + "line": 4, + }, + }, + "range": Array [ + 115, + 124, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 4, + }, + "start": Object { + "column": 53, + "line": 4, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 54, + "line": 4, + }, + }, + "range": Array [ + 125, + 130, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 131, + 140, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 140, + 141, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 141, + 147, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 21, + "line": 5, + }, + }, + "range": Array [ + 147, + 148, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "range": Array [ + 164, + 167, + ], + "type": "JSXIdentifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 5, + }, + "start": Object { + "column": 41, + "line": 5, + }, + }, + "range": Array [ + 167, + 168, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 5, + }, + "start": Object { + "column": 42, + "line": 5, + }, + }, + "range": Array [ + 168, + 169, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 5, + }, + "start": Object { + "column": 43, + "line": 5, + }, + }, + "range": Array [ + 169, + 170, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 5, + }, + "start": Object { + "column": 44, + "line": 5, + }, + }, + "range": Array [ + 170, + 179, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 53, + "line": 5, + }, + }, + "range": Array [ + 179, + 180, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 6, + }, + "start": Object { + "column": 54, + "line": 5, + }, + }, + "range": Array [ + 180, + 185, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 185, + 186, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "range": Array [ + 186, + 195, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 195, + 196, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 15, + "line": 6, + }, + }, + "range": Array [ + 196, + 202, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 21, + "line": 6, + }, + }, + "range": Array [ + 202, + 203, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "range": Array [ + 204, + 207, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 6, + }, + "start": Object { + "column": 42, + "line": 6, + }, + }, + "range": Array [ + 223, + 226, + ], + "type": "JSXIdentifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 6, + }, + "start": Object { + "column": 45, + "line": 6, + }, + }, + "range": Array [ + 226, + 227, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 6, + }, + "start": Object { + "column": 46, + "line": 6, + }, + }, + "range": Array [ + 227, + 228, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 6, + }, + "start": Object { + "column": 47, + "line": 6, + }, + }, + "range": Array [ + 228, + 229, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 6, + }, + "start": Object { + "column": 48, + "line": 6, + }, + }, + "range": Array [ + 229, + 238, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 6, + }, + "start": Object { + "column": 57, + "line": 6, + }, + }, + "range": Array [ + 238, + 239, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 8, + }, + "start": Object { + "column": 58, + "line": 6, + }, + }, + "range": Array [ + 239, + 245, + ], + "type": "JSXText", + "value": " + + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 245, + 246, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 5, + "line": 8, + }, + }, + "range": Array [ + 246, + 255, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 14, + "line": 8, + }, + }, + "range": Array [ + 255, + 256, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 256, + 262, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 8, + }, + "start": Object { + "column": 21, + "line": 8, + }, + }, + "range": Array [ + 262, + 263, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 10, + }, + }, + "range": Array [ + 286, + 287, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 10, + }, + "start": Object { + "column": 5, + "line": 10, + }, + }, + "range": Array [ + 287, + 288, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 10, + }, + "start": Object { + "column": 6, + "line": 10, + }, + }, + "range": Array [ + 288, + 289, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 10, + }, + "start": Object { + "column": 7, + "line": 10, + }, + }, + "range": Array [ + 289, + 298, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 10, + }, + "start": Object { + "column": 16, + "line": 10, + }, + }, + "range": Array [ + 298, + 299, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 11, + }, + "start": Object { + "column": 17, + "line": 10, + }, + }, + "range": Array [ + 299, + 304, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "range": Array [ + 304, + 305, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 11, + }, + "start": Object { + "column": 5, + "line": 11, + }, + }, + "range": Array [ + 305, + 314, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 11, + }, + "start": Object { + "column": 14, + "line": 11, + }, + }, + "range": Array [ + 314, + 315, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 11, + }, + "start": Object { + "column": 15, + "line": 11, + }, + }, + "range": Array [ + 315, + 321, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 11, + }, + "start": Object { + "column": 21, + "line": 11, + }, + }, + "range": Array [ + 321, + 322, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 12, + }, + "start": Object { + "column": 6, + "line": 12, + }, + }, + "range": Array [ + 329, + 332, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "range": Array [ + 355, + 356, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 14, + }, + "start": Object { + "column": 5, + "line": 14, + }, + }, + "range": Array [ + 356, + 357, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 14, + }, + "start": Object { + "column": 6, + "line": 14, + }, + }, + "range": Array [ + 357, + 358, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 14, + }, + "start": Object { + "column": 7, + "line": 14, + }, + }, + "range": Array [ + 358, + 367, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 14, + }, + "start": Object { + "column": 16, + "line": 14, + }, + }, + "range": Array [ + 367, + 368, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 15, + }, + "start": Object { + "column": 17, + "line": 14, + }, + }, + "range": Array [ + 368, + 373, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 15, + }, + "start": Object { + "column": 4, + "line": 15, + }, + }, + "range": Array [ + 373, + 374, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 15, + }, + "start": Object { + "column": 5, + "line": 15, + }, + }, + "range": Array [ + 374, + 383, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 15, + }, + "start": Object { + "column": 14, + "line": 15, + }, + }, + "range": Array [ + 383, + 384, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 15, + }, + "start": Object { + "column": 15, + "line": 15, + }, + }, + "range": Array [ + 384, + 390, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 15, + }, + "start": Object { + "column": 21, + "line": 15, + }, + }, + "range": Array [ + 390, + 391, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 17, + }, + "start": Object { + "column": 6, + "line": 17, + }, + }, + "range": Array [ + 416, + 419, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 18, + }, + "start": Object { + "column": 4, + "line": 18, + }, + }, + "range": Array [ + 424, + 425, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 18, + }, + "start": Object { + "column": 5, + "line": 18, + }, + }, + "range": Array [ + 425, + 426, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 18, + }, + "start": Object { + "column": 6, + "line": 18, + }, + }, + "range": Array [ + 426, + 427, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 18, + }, + "start": Object { + "column": 7, + "line": 18, + }, + }, + "range": Array [ + 427, + 436, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 18, + }, + "start": Object { + "column": 16, + "line": 18, + }, + }, + "range": Array [ + 436, + 437, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 19, + }, + "start": Object { + "column": 17, + "line": 18, + }, + }, + "range": Array [ + 437, + 442, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 19, + }, + "start": Object { + "column": 4, + "line": 19, + }, + }, + "range": Array [ + 442, + 443, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 19, + }, + "start": Object { + "column": 5, + "line": 19, + }, + }, + "range": Array [ + 443, + 452, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 19, + }, + "start": Object { + "column": 14, + "line": 19, + }, + }, + "range": Array [ + 452, + 453, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 19, + }, + "start": Object { + "column": 15, + "line": 19, + }, + }, + "range": Array [ + 453, + 459, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 19, + }, + "start": Object { + "column": 21, + "line": 19, + }, + }, + "range": Array [ + 459, + 460, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 20, + }, + "start": Object { + "column": 6, + "line": 20, + }, + }, + "range": Array [ + 467, + 470, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 22, + }, + "start": Object { + "column": 6, + "line": 22, + }, + }, + "range": Array [ + 495, + 498, + ], + "type": "JSXIdentifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 23, + }, + "start": Object { + "column": 4, + "line": 23, + }, + }, + "range": Array [ + 503, + 504, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 23, + }, + "start": Object { + "column": 5, + "line": 23, + }, + }, + "range": Array [ + 504, + 505, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 23, + }, + "start": Object { + "column": 6, + "line": 23, + }, + }, + "range": Array [ + 505, + 506, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 23, + }, + "start": Object { + "column": 7, + "line": 23, + }, + }, + "range": Array [ + 506, + 515, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 23, + }, + "start": Object { + "column": 16, + "line": 23, + }, + }, + "range": Array [ + 515, + 516, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 24, + }, + "start": Object { + "column": 17, + "line": 23, + }, + }, + "range": Array [ + 516, + 519, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 24, + }, + "start": Object { + "column": 2, + "line": 24, + }, + }, + "range": Array [ + 519, + 520, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 24, + }, + "start": Object { + "column": 3, + "line": 24, + }, + }, + "range": Array [ + 520, + 521, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 24, + }, + "start": Object { + "column": 4, + "line": 24, + }, + }, + "range": Array [ + 521, + 522, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 25, + }, + "start": Object { + "column": 0, + "line": 25, + }, + }, + "range": Array [ + 523, + 524, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 25, + }, + "start": Object { + "column": 1, + "line": 25, + }, + }, + "range": Array [ + 524, + 525, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-tag-comment-after-prop.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-tag-comment-after-prop.src.js.shot new file mode 100644 index 00000000000..9cc61ef5262 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-tag-comment-after-prop.src.js.shot @@ -0,0 +1,799 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments jsx-tag-comment-after-prop.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "pure", + "optional": false, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": "foo", + "range": Array [ + 66, + 69, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 66, + 75, + ], + "type": "JSXAttribute", + "value": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 71, + 74, + ], + "raw": "123", + "type": "Literal", + "value": 123, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 70, + 75, + ], + "type": "JSXExpressionContainer", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "name": "bar", + "range": Array [ + 99, + 102, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 99, + 109, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 103, + 109, + ], + "raw": "\\"woof\\"", + "type": "Literal", + "value": "woof", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "name": "Foo", + "range": Array [ + 39, + 42, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 38, + 118, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 38, + 118, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 23, + 123, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 125, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 13, + 125, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 125, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 125, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 51, + 57, + ], + "type": "Line", + "value": " one", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 84, + 90, + ], + "type": "Line", + "value": " two", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 127, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "value": "pure", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "JSXIdentifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 66, + 69, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 71, + 74, + ], + "type": "Numeric", + "value": "123", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 99, + 102, + ], + "type": "JSXIdentifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 103, + 109, + ], + "type": "JSXText", + "value": "\\"woof\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 8, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 121, + 122, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "range": Array [ + 122, + 123, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 10, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-tag-comments.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-tag-comments.src.js.shot new file mode 100644 index 00000000000..7f900cacc43 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-tag-comments.src.js.shot @@ -0,0 +1,658 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments jsx-tag-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "pure", + "optional": false, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 103, + 112, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "name": "Foo", + "range": Array [ + 114, + 117, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 112, + 118, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "Foo", + "range": Array [ + 43, + 46, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 42, + 103, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 42, + 118, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 125, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 127, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 13, + 127, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 127, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 127, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 59, + 68, + ], + "type": "Line", + "value": " single", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 81, + 92, + ], + "type": "Block", + "value": " block ", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 11, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 129, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "value": "pure", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 43, + 46, + ], + "type": "JSXIdentifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 103, + 112, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 114, + 117, + ], + "type": "JSXIdentifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 123, + 124, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 8, + }, + "start": Object { + "column": 5, + "line": 8, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 126, + 127, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-text-with-multiline-non-comment.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-text-with-multiline-non-comment.src.js.shot new file mode 100644 index 00000000000..39839405cec --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-text-with-multiline-non-comment.src.js.shot @@ -0,0 +1,630 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments jsx-text-with-multiline-non-comment.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "pure", + "optional": false, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 41, + 80, + ], + "raw": " + /** + * test + */ + ", + "type": "JSXText", + "value": " + /** + * test + */ + ", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "name": "Foo", + "range": Array [ + 82, + 85, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 80, + 86, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "Foo", + "range": Array [ + 37, + 40, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 36, + 41, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 36, + 86, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 23, + 91, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 93, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 13, + 93, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 93, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 93, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 94, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "value": "pure", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 37, + 40, + ], + "type": "JSXIdentifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 41, + 80, + ], + "type": "JSXText", + "value": " + /** + * test + */ + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 82, + 85, + ], + "type": "JSXIdentifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 8, + }, + "start": Object { + "column": 3, + "line": 8, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-text-with-url.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-text-with-url.src.js.shot new file mode 100644 index 00000000000..cf4fda8c7c8 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-text-with-url.src.js.shot @@ -0,0 +1,2303 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments jsx-text-with-url.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "first", + "optional": false, + "range": Array [ + 6, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 37, + ], + "raw": "http://example.com", + "type": "JSXText", + "value": "http://example.com", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 39, + 42, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 37, + 43, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 15, + 18, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 14, + 19, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 14, + 43, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 43, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "second", + "optional": false, + "range": Array [ + 52, + 58, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 63, + 81, + ], + "raw": "http://example.com", + "type": "JSXText", + "value": "http://example.com", + }, + ], + "closingFragment": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 35, + "line": 3, + }, + }, + "range": Array [ + 81, + 84, + ], + "type": "JSXClosingFragment", + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "openingFragment": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 61, + 63, + ], + "type": "JSXOpeningFragment", + }, + "range": Array [ + 61, + 84, + ], + "type": "JSXFragment", + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 52, + 84, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 46, + 85, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": "third", + "optional": false, + "range": Array [ + 93, + 98, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "children": Array [ + Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "name": "br", + "range": Array [ + 107, + 109, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 106, + 112, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 106, + 112, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 5, + }, + "start": Object { + "column": 25, + "line": 5, + }, + }, + "range": Array [ + 112, + 130, + ], + "raw": "http://example.com", + "type": "JSXText", + "value": "http://example.com", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 43, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 5, + }, + "start": Object { + "column": 45, + "line": 5, + }, + }, + "name": "div", + "range": Array [ + 132, + 135, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 130, + 136, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "name": "div", + "range": Array [ + 102, + 105, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 101, + 106, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 101, + 136, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 93, + 136, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 50, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 87, + 137, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "name": "fourth", + "optional": false, + "range": Array [ + 145, + 151, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "children": Array [ + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 7, + }, + "start": Object { + "column": 26, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 7, + }, + "start": Object { + "column": 28, + "line": 7, + }, + }, + "name": "span", + "range": Array [ + 167, + 171, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 165, + 172, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 7, + }, + "start": Object { + "column": 21, + "line": 7, + }, + }, + "name": "span", + "range": Array [ + 160, + 164, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 159, + 165, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 159, + 172, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 7, + }, + "start": Object { + "column": 33, + "line": 7, + }, + }, + "range": Array [ + 172, + 190, + ], + "raw": "http://example.com", + "type": "JSXText", + "value": "http://example.com", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 7, + }, + "start": Object { + "column": 51, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 7, + }, + "start": Object { + "column": 53, + "line": 7, + }, + }, + "name": "div", + "range": Array [ + 192, + 195, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 190, + 196, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 57, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 7, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 7, + }, + }, + "name": "div", + "range": Array [ + 155, + 158, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 154, + 159, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 154, + 196, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 57, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 145, + 196, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 58, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 139, + 197, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 9, + }, + }, + "name": "fifth", + "optional": false, + "range": Array [ + 205, + 210, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "children": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 9, + }, + "start": Object { + "column": 20, + "line": 9, + }, + }, + "range": Array [ + 219, + 219, + ], + "type": "JSXEmptyExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 9, + }, + "start": Object { + "column": 19, + "line": 9, + }, + }, + "range": Array [ + 218, + 220, + ], + "type": "JSXExpressionContainer", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 9, + }, + "start": Object { + "column": 21, + "line": 9, + }, + }, + "range": Array [ + 220, + 238, + ], + "raw": "http://example.com", + "type": "JSXText", + "value": "http://example.com", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 9, + }, + "start": Object { + "column": 39, + "line": 9, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 9, + }, + "start": Object { + "column": 41, + "line": 9, + }, + }, + "name": "div", + "range": Array [ + 240, + 243, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 238, + 244, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 45, + "line": 9, + }, + "start": Object { + "column": 14, + "line": 9, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 14, + "line": 9, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 15, + "line": 9, + }, + }, + "name": "div", + "range": Array [ + 214, + 217, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 213, + 218, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 213, + 244, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 45, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 9, + }, + }, + "range": Array [ + 205, + 244, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 46, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 199, + 245, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 246, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "Identifier", + "value": "first", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 37, + ], + "type": "JSXText", + "value": "http://example.com", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 46, + 51, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 52, + 58, + ], + "type": "Identifier", + "value": "second", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 63, + 81, + ], + "type": "JSXText", + "value": "http://example.com", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 35, + "line": 3, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 3, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 38, + "line": 3, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 87, + 92, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 93, + 98, + ], + "type": "Identifier", + "value": "third", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 99, + 100, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 101, + 102, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 102, + 105, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 107, + 109, + ], + "type": "JSXIdentifier", + "value": "br", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 23, + "line": 5, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 24, + "line": 5, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 5, + }, + "start": Object { + "column": 25, + "line": 5, + }, + }, + "range": Array [ + 112, + 130, + ], + "type": "JSXText", + "value": "http://example.com", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 5, + }, + "start": Object { + "column": 43, + "line": 5, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 5, + }, + "start": Object { + "column": 44, + "line": 5, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 5, + }, + "start": Object { + "column": 45, + "line": 5, + }, + }, + "range": Array [ + 132, + 135, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 48, + "line": 5, + }, + }, + "range": Array [ + 135, + 136, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 5, + }, + "start": Object { + "column": 49, + "line": 5, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 139, + 144, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 145, + 151, + ], + "type": "Identifier", + "value": "fourth", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 152, + 153, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 7, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 7, + }, + }, + "range": Array [ + 155, + 158, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 7, + }, + "start": Object { + "column": 19, + "line": 7, + }, + }, + "range": Array [ + 158, + 159, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 159, + 160, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 7, + }, + "start": Object { + "column": 21, + "line": 7, + }, + }, + "range": Array [ + 160, + 164, + ], + "type": "JSXIdentifier", + "value": "span", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 7, + }, + "start": Object { + "column": 25, + "line": 7, + }, + }, + "range": Array [ + 164, + 165, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 7, + }, + "start": Object { + "column": 26, + "line": 7, + }, + }, + "range": Array [ + 165, + 166, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 7, + }, + "start": Object { + "column": 27, + "line": 7, + }, + }, + "range": Array [ + 166, + 167, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 7, + }, + "start": Object { + "column": 28, + "line": 7, + }, + }, + "range": Array [ + 167, + 171, + ], + "type": "JSXIdentifier", + "value": "span", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 7, + }, + "start": Object { + "column": 32, + "line": 7, + }, + }, + "range": Array [ + 171, + 172, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 7, + }, + "start": Object { + "column": 33, + "line": 7, + }, + }, + "range": Array [ + 172, + 190, + ], + "type": "JSXText", + "value": "http://example.com", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 7, + }, + "start": Object { + "column": 51, + "line": 7, + }, + }, + "range": Array [ + 190, + 191, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 7, + }, + "start": Object { + "column": 52, + "line": 7, + }, + }, + "range": Array [ + 191, + 192, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 7, + }, + "start": Object { + "column": 53, + "line": 7, + }, + }, + "range": Array [ + 192, + 195, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 7, + }, + "start": Object { + "column": 56, + "line": 7, + }, + }, + "range": Array [ + 195, + 196, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 7, + }, + "start": Object { + "column": 57, + "line": 7, + }, + }, + "range": Array [ + 196, + 197, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 199, + 204, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 9, + }, + }, + "range": Array [ + 205, + 210, + ], + "type": "Identifier", + "value": "fifth", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "range": Array [ + 211, + 212, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 9, + }, + "start": Object { + "column": 14, + "line": 9, + }, + }, + "range": Array [ + 213, + 214, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 15, + "line": 9, + }, + }, + "range": Array [ + 214, + 217, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 18, + "line": 9, + }, + }, + "range": Array [ + 217, + 218, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 9, + }, + "start": Object { + "column": 19, + "line": 9, + }, + }, + "range": Array [ + 218, + 219, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 9, + }, + "start": Object { + "column": 20, + "line": 9, + }, + }, + "range": Array [ + 219, + 220, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 9, + }, + "start": Object { + "column": 21, + "line": 9, + }, + }, + "range": Array [ + 220, + 238, + ], + "type": "JSXText", + "value": "http://example.com", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 9, + }, + "start": Object { + "column": 39, + "line": 9, + }, + }, + "range": Array [ + 238, + 239, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 9, + }, + "start": Object { + "column": 40, + "line": 9, + }, + }, + "range": Array [ + 239, + 240, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 9, + }, + "start": Object { + "column": 41, + "line": 9, + }, + }, + "range": Array [ + 240, + 243, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 9, + }, + "start": Object { + "column": 44, + "line": 9, + }, + }, + "range": Array [ + 243, + 244, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 9, + }, + "start": Object { + "column": 45, + "line": 9, + }, + }, + "range": Array [ + 244, + 245, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-with-greather-than.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-with-greather-than.src.js.shot new file mode 100644 index 00000000000..5259bfe57ae --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-with-greather-than.src.js.shot @@ -0,0 +1,894 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments jsx-with-greather-than.src 1`] = ` +Object { + "body": Array [ + Object { + "alternate": null, + "consequent": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "operator": ">>", + "range": Array [ + 30, + 36, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "type": "BinaryExpression", + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "test", + "optional": false, + "range": Array [ + 24, + 28, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 24, + 37, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 24, + 38, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 59, + 61, + ], + "raw": "//", + "type": "JSXText", + "value": "//", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "name": "test", + "range": Array [ + 63, + 67, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 61, + 68, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "test", + "range": Array [ + 54, + 58, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 53, + 59, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 53, + 68, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 47, + 68, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 41, + 68, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 70, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 70, + ], + "test": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "operator": ">", + "range": Array [ + 4, + 18, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "type": "BinaryExpression", + }, + "type": "IfStatement", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 17, + ], + "type": "Block", + "value": " Test ", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 71, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 2, + ], + "type": "Keyword", + "value": "if", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 24, + 28, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 32, + 34, + ], + "type": "Punctuator", + "value": ">>", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 41, + 46, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 54, + 58, + ], + "type": "JSXIdentifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 59, + 61, + ], + "type": "JSXText", + "value": "//", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 63, + 67, + ], + "type": "JSXIdentifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/jsx-with-operators.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/jsx-with-operators.src.js.shot new file mode 100644 index 00000000000..450afc1e806 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/jsx-with-operators.src.js.shot @@ -0,0 +1,894 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments jsx-with-operators.src 1`] = ` +Object { + "body": Array [ + Object { + "alternate": null, + "consequent": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "operator": ">>", + "range": Array [ + 30, + 36, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "type": "BinaryExpression", + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "test", + "optional": false, + "range": Array [ + 24, + 28, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 24, + 37, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 24, + 38, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 59, + 61, + ], + "raw": "//", + "type": "JSXText", + "value": "//", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "name": "test", + "range": Array [ + 63, + 67, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 61, + 68, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "test", + "range": Array [ + 54, + 58, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 53, + 59, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 53, + 68, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 47, + 68, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 41, + 68, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 70, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 70, + ], + "test": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "operator": "<", + "range": Array [ + 4, + 18, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "type": "BinaryExpression", + }, + "type": "IfStatement", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 17, + ], + "type": "Block", + "value": " Test ", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 71, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 2, + ], + "type": "Keyword", + "value": "if", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 24, + 28, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 32, + 34, + ], + "type": "Punctuator", + "value": ">>", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 41, + 46, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 54, + 58, + ], + "type": "JSXIdentifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 59, + 61, + ], + "type": "JSXText", + "value": "//", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 63, + 67, + ], + "type": "JSXIdentifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/mix-line-and-block-comments.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/mix-line-and-block-comments.src.js.shot new file mode 100644 index 00000000000..5966397a09f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/mix-line-and-block-comments.src.js.shot @@ -0,0 +1,251 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments mix-line-and-block-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "zzz", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 24, + 27, + ], + "raw": "777", + "type": "Literal", + "value": 777, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 27, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 6, + 28, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Line", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Block", + "value": "aaa", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 29, + 34, + ], + "type": "Line", + "value": "bar", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 6, + 35, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "zzz", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "Numeric", + "value": "777", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/no-comment-regex.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/no-comment-regex.src.js.shot new file mode 100644 index 00000000000..140681a1d94 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/no-comment-regex.src.js.shot @@ -0,0 +1,204 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments no-comment-regex.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "regex", + "optional": false, + "range": Array [ + 6, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 33, + ], + "raw": "/no comment\\\\/**foo/", + "regex": Object { + "flags": "", + "pattern": "no comment\\\\/**foo", + }, + "type": "Literal", + "value": null, + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 33, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "Identifier", + "value": "regex", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 33, + ], + "regex": Object { + "flags": "", + "pattern": "no comment\\\\/**foo", + }, + "type": "RegularExpression", + "value": "/no comment\\\\/**foo/", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/no-comment-template.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/no-comment-template.src.js.shot new file mode 100644 index 00000000000..5f56111360c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/no-comment-template.src.js.shot @@ -0,0 +1,299 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments no-comment-template.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "str", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "expressions": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "__dirname", + "optional": false, + "range": Array [ + 15, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": "", + "raw": "", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 36, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "/test/*.js", + "raw": "/test/*.js", + }, + }, + ], + "range": Array [ + 12, + 36, + ], + "type": "TemplateLiteral", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 36, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "str", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Template", + "value": "\`\${", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 24, + ], + "type": "Identifier", + "value": "__dirname", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 36, + ], + "type": "Template", + "value": "}/test/*.js\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/surrounding-call-comments.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/surrounding-call-comments.src.js.shot new file mode 100644 index 00000000000..4bc091f11c9 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/surrounding-call-comments.src.js.shot @@ -0,0 +1,367 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments surrounding-call-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 36, + 39, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "optional": false, + "range": Array [ + 36, + 41, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 60, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 60, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 31, + ], + "type": "Block", + "value": " before ", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 47, + 58, + ], + "type": "Block", + "value": " after ", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 61, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 39, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/surrounding-debugger-comments.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/surrounding-debugger-comments.src.js.shot new file mode 100644 index 00000000000..b4a4fd0d2eb --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/surrounding-debugger-comments.src.js.shot @@ -0,0 +1,289 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments surrounding-debugger-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 45, + ], + "type": "DebuggerStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 63, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 63, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 31, + ], + "type": "Block", + "value": " before ", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 50, + 61, + ], + "type": "Block", + "value": " after ", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 64, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 44, + ], + "type": "Keyword", + "value": "debugger", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/surrounding-return-comments.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/surrounding-return-comments.src.js.shot new file mode 100644 index 00000000000..2b489829d21 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/surrounding-return-comments.src.js.shot @@ -0,0 +1,290 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments surrounding-return-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 43, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 61, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 61, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 31, + ], + "type": "Block", + "value": " before ", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 48, + 59, + ], + "type": "Block", + "value": " after ", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 62, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/surrounding-throw-comments.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/surrounding-throw-comments.src.js.shot new file mode 100644 index 00000000000..4c7ece7aa12 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/surrounding-throw-comments.src.js.shot @@ -0,0 +1,326 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments surrounding-throw-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 42, + 44, + ], + "raw": "55", + "type": "Literal", + "value": 55, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 45, + ], + "type": "ThrowStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 63, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 63, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 31, + ], + "type": "Block", + "value": " before ", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 50, + 61, + ], + "type": "Block", + "value": " after ", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 64, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 41, + ], + "type": "Keyword", + "value": "throw", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 42, + 44, + ], + "type": "Numeric", + "value": "55", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/surrounding-while-loop-comments.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/surrounding-while-loop-comments.src.js.shot new file mode 100644 index 00000000000..37f5b7aa1f8 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/surrounding-while-loop-comments.src.js.shot @@ -0,0 +1,513 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments surrounding-while-loop-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 46, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 46, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 41, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + "type": "WhileStatement", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 65, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "name": "each", + "optional": false, + "range": Array [ + 61, + 65, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 65, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "range": Array [ + 61, + 65, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 66, + "line": 1, + }, + "start": Object { + "column": 57, + "line": 1, + }, + }, + "range": Array [ + 57, + 66, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 68, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 68, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 29, + ], + "type": "Block", + "value": " infinite ", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 56, + ], + "type": "Block", + "value": " bar ", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 69, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 35, + ], + "type": "Keyword", + "value": "while", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 41, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 60, + "line": 1, + }, + "start": Object { + "column": 57, + "line": 1, + }, + }, + "range": Array [ + 57, + 60, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "range": Array [ + 61, + 65, + ], + "type": "Identifier", + "value": "each", + }, + Object { + "loc": Object { + "end": Object { + "column": 66, + "line": 1, + }, + "start": Object { + "column": 65, + "line": 1, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 67, + "line": 1, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/switch-fallthrough-comment-in-function.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/switch-fallthrough-comment-in-function.src.js.shot new file mode 100644 index 00000000000..18abdc0cf22 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/switch-fallthrough-comment-in-function.src.js.shot @@ -0,0 +1,738 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments switch-fallthrough-comment-in-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "cases": Array [ + Object { + "consequent": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 61, + 68, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 66, + 67, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "SwitchCase", + }, + Object { + "consequent": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "name": "doIt", + "optional": false, + "range": Array [ + 126, + 130, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "optional": false, + "range": Array [ + 126, + 132, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 126, + 133, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 106, + 133, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 111, + 112, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "type": "SwitchCase", + }, + ], + "discriminant": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 24, + 139, + ], + "type": "SwitchStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 141, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 141, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "Line", + "value": " foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 81, + 97, + ], + "type": "Line", + "value": " falls through", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 142, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 24, + 30, + ], + "type": "Keyword", + "value": "switch", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 61, + 65, + ], + "type": "Keyword", + "value": "case", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 106, + 110, + ], + "type": "Keyword", + "value": "case", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 126, + 130, + ], + "type": "Identifier", + "value": "doIt", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 7, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 18, + "line": 7, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 138, + 139, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 140, + 141, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/switch-fallthrough-comment.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/switch-fallthrough-comment.src.js.shot new file mode 100644 index 00000000000..b24e17d0447 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/switch-fallthrough-comment.src.js.shot @@ -0,0 +1,526 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments switch-fallthrough-comment.src 1`] = ` +Object { + "body": Array [ + Object { + "cases": Array [ + Object { + "consequent": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 29, + 36, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "SwitchCase", + }, + Object { + "consequent": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "name": "doIt", + "optional": false, + "range": Array [ + 82, + 86, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "optional": false, + "range": Array [ + 82, + 88, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 82, + 89, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 66, + 89, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 71, + 72, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "type": "SwitchCase", + }, + ], + "discriminant": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 91, + ], + "type": "SwitchStatement", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 24, + ], + "type": "Line", + "value": " foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 45, + 61, + ], + "type": "Line", + "value": " falls through", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 92, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "switch", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 29, + 33, + ], + "type": "Keyword", + "value": "case", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 66, + 70, + ], + "type": "Keyword", + "value": "case", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 82, + 86, + ], + "type": "Identifier", + "value": "doIt", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 87, + 88, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/switch-no-default-comment-in-function.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/switch-no-default-comment-in-function.src.js.shot new file mode 100644 index 00000000000..87d736c4f0e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/switch-no-default-comment-in-function.src.js.shot @@ -0,0 +1,698 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments switch-no-default-comment-in-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "cases": Array [ + Object { + "consequent": Array [ + Object { + "label": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 63, + 69, + ], + "type": "BreakStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 43, + 69, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "type": "SwitchCase", + }, + Object { + "consequent": Array [ + Object { + "label": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 98, + 104, + ], + "type": "BreakStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 78, + 104, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 83, + 84, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "SwitchCase", + }, + ], + "discriminant": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 131, + ], + "type": "SwitchStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 133, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 133, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 113, + 125, + ], + "type": "Line", + "value": "no default", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 134, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Keyword", + "value": "switch", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 43, + 47, + ], + "type": "Keyword", + "value": "case", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 63, + 68, + ], + "type": "Keyword", + "value": "break", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 78, + 82, + ], + "type": "Keyword", + "value": "case", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 98, + 103, + ], + "type": "Keyword", + "value": "break", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/switch-no-default-comment-in-nested-functions.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/switch-no-default-comment-in-nested-functions.src.js.shot new file mode 100644 index 00000000000..9614231c22c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/switch-no-default-comment-in-nested-functions.src.js.shot @@ -0,0 +1,1608 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments switch-no-default-comment-in-nested-functions.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "module", + "optional": false, + "range": Array [ + 0, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "exports", + "optional": false, + "range": Array [ + 7, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 0, + 14, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 286, + ], + "right": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "cases": Array [ + Object { + "consequent": Array [ + Object { + "argument": Object { + "arguments": Array [ + Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 79, + "line": 6, + }, + "start": Object { + "column": 34, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 50, + "line": 6, + }, + "start": Object { + "column": 34, + "line": 6, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 6, + }, + "start": Object { + "column": 34, + "line": 6, + }, + }, + "name": "node", + "optional": false, + "range": Array [ + 172, + 176, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 50, + "line": 6, + }, + "start": Object { + "column": 39, + "line": 6, + }, + }, + "name": "expressions", + "optional": false, + "range": Array [ + 177, + 188, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 172, + 188, + ], + "type": "MemberExpression", + }, + "optional": false, + "property": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 74, + "line": 6, + }, + "start": Object { + "column": 51, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 67, + "line": 6, + }, + "start": Object { + "column": 51, + "line": 6, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 55, + "line": 6, + }, + "start": Object { + "column": 51, + "line": 6, + }, + }, + "name": "node", + "optional": false, + "range": Array [ + 189, + 193, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 67, + "line": 6, + }, + "start": Object { + "column": 56, + "line": 6, + }, + }, + "name": "expressions", + "optional": false, + "range": Array [ + 194, + 205, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 189, + 205, + ], + "type": "MemberExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 74, + "line": 6, + }, + "start": Object { + "column": 68, + "line": 6, + }, + }, + "name": "length", + "optional": false, + "range": Array [ + 206, + 212, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 189, + 212, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 78, + "line": 6, + }, + "start": Object { + "column": 51, + "line": 6, + }, + }, + "operator": "-", + "range": Array [ + 189, + 216, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 78, + "line": 6, + }, + "start": Object { + "column": 77, + "line": 6, + }, + }, + "range": Array [ + 215, + 216, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "BinaryExpression", + }, + "range": Array [ + 172, + 217, + ], + "type": "MemberExpression", + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "name": "isConstant", + "optional": false, + "range": Array [ + 161, + 171, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 80, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "optional": false, + "range": Array [ + 161, + 218, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 81, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 154, + 219, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 81, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 111, + 219, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 116, + 136, + ], + "raw": "\\"SequenceExpression\\"", + "type": "Literal", + "value": "SequenceExpression", + }, + "type": "SwitchCase", + }, + ], + "discriminant": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "name": "node", + "optional": false, + "range": Array [ + 86, + 90, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "name": "type", + "optional": false, + "range": Array [ + 91, + 95, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 86, + 95, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 78, + 255, + ], + "type": "SwitchStatement", + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 9, + }, + "start": Object { + "column": 15, + "line": 9, + }, + }, + "range": Array [ + 271, + 276, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "range": Array [ + 264, + 277, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 10, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 68, + 283, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "isConstant", + "optional": false, + "range": Array [ + 51, + 61, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "name": "node", + "optional": false, + "range": Array [ + 62, + 66, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 42, + 283, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 286, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "context", + "optional": false, + "range": Array [ + 26, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 17, + 286, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 287, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 232, + 245, + ], + "type": "Line", + "value": " no default", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 288, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Identifier", + "value": "exports", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 25, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 33, + ], + "type": "Identifier", + "value": "context", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 42, + 50, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 51, + 61, + ], + "type": "Identifier", + "value": "isConstant", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 62, + 66, + ], + "type": "Identifier", + "value": "node", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 78, + 84, + ], + "type": "Keyword", + "value": "switch", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 86, + 90, + ], + "type": "Identifier", + "value": "node", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 20, + "line": 4, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 91, + 95, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 111, + 115, + ], + "type": "Keyword", + "value": "case", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 116, + 136, + ], + "type": "String", + "value": "\\"SequenceExpression\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 5, + }, + "start": Object { + "column": 37, + "line": 5, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 154, + 160, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "range": Array [ + 161, + 171, + ], + "type": "Identifier", + "value": "isConstant", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 6, + }, + "start": Object { + "column": 33, + "line": 6, + }, + }, + "range": Array [ + 171, + 172, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 6, + }, + "start": Object { + "column": 34, + "line": 6, + }, + }, + "range": Array [ + 172, + 176, + ], + "type": "Identifier", + "value": "node", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 6, + }, + "start": Object { + "column": 38, + "line": 6, + }, + }, + "range": Array [ + 176, + 177, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 6, + }, + "start": Object { + "column": 39, + "line": 6, + }, + }, + "range": Array [ + 177, + 188, + ], + "type": "Identifier", + "value": "expressions", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 6, + }, + "start": Object { + "column": 50, + "line": 6, + }, + }, + "range": Array [ + 188, + 189, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 6, + }, + "start": Object { + "column": 51, + "line": 6, + }, + }, + "range": Array [ + 189, + 193, + ], + "type": "Identifier", + "value": "node", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 6, + }, + "start": Object { + "column": 55, + "line": 6, + }, + }, + "range": Array [ + 193, + 194, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 67, + "line": 6, + }, + "start": Object { + "column": 56, + "line": 6, + }, + }, + "range": Array [ + 194, + 205, + ], + "type": "Identifier", + "value": "expressions", + }, + Object { + "loc": Object { + "end": Object { + "column": 68, + "line": 6, + }, + "start": Object { + "column": 67, + "line": 6, + }, + }, + "range": Array [ + 205, + 206, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 6, + }, + "start": Object { + "column": 68, + "line": 6, + }, + }, + "range": Array [ + 206, + 212, + ], + "type": "Identifier", + "value": "length", + }, + Object { + "loc": Object { + "end": Object { + "column": 76, + "line": 6, + }, + "start": Object { + "column": 75, + "line": 6, + }, + }, + "range": Array [ + 213, + 214, + ], + "type": "Punctuator", + "value": "-", + }, + Object { + "loc": Object { + "end": Object { + "column": 78, + "line": 6, + }, + "start": Object { + "column": 77, + "line": 6, + }, + }, + "range": Array [ + 215, + 216, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 6, + }, + "start": Object { + "column": 78, + "line": 6, + }, + }, + "range": Array [ + 216, + 217, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 80, + "line": 6, + }, + "start": Object { + "column": 79, + "line": 6, + }, + }, + "range": Array [ + 217, + 218, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 81, + "line": 6, + }, + "start": Object { + "column": 80, + "line": 6, + }, + }, + "range": Array [ + 218, + 219, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 254, + 255, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "range": Array [ + 264, + 270, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 9, + }, + "start": Object { + "column": 15, + "line": 9, + }, + }, + "range": Array [ + 271, + 276, + ], + "type": "Boolean", + "value": "false", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 9, + }, + "start": Object { + "column": 20, + "line": 9, + }, + }, + "range": Array [ + 276, + 277, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 10, + }, + }, + "range": Array [ + 282, + 283, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 12, + }, + }, + "range": Array [ + 285, + 286, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 12, + }, + "start": Object { + "column": 1, + "line": 12, + }, + }, + "range": Array [ + 286, + 287, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/switch-no-default-comment.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/switch-no-default-comment.src.js.shot new file mode 100644 index 00000000000..53613d3d8d9 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/switch-no-default-comment.src.js.shot @@ -0,0 +1,340 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments switch-no-default-comment.src 1`] = ` +Object { + "body": Array [ + Object { + "cases": Array [ + Object { + "consequent": Array [ + Object { + "label": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 33, + 39, + ], + "type": "BreakStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 39, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "SwitchCase", + }, + ], + "discriminant": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 58, + ], + "type": "SwitchStatement", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 44, + 56, + ], + "type": "Line", + "value": "no default", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 59, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "switch", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "Keyword", + "value": "case", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 33, + 38, + ], + "type": "Keyword", + "value": "break", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/template-string-block.src.js.shot b/packages/typescript-estree/tests/snapshots/comments/template-string-block.src.js.shot new file mode 100644 index 00000000000..7239d1f6e53 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/template-string-block.src.js.shot @@ -0,0 +1,423 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments template-string-block.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "expressions": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "name", + "optional": false, + "range": Array [ + 3, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": "", + "raw": "", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "", + "raw": "", + }, + }, + ], + "range": Array [ + 0, + 9, + ], + "type": "TemplateLiteral", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "type": "ExpressionStatement", + }, + Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 56, + 57, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "operator": "+", + "range": Array [ + 56, + 61, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 60, + 61, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 56, + 62, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 11, + 64, + ], + "type": "BlockStatement", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 17, + 51, + ], + "type": "Block", + "value": " TODO comment comment comment ", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Template", + "value": "\`\${", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 7, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Template", + "value": "}\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/comments/type-assertion-regression-test.src.ts.shot b/packages/typescript-estree/tests/snapshots/comments/type-assertion-regression-test.src.ts.shot new file mode 100644 index 00000000000..f3145c864a8 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/comments/type-assertion-regression-test.src.ts.shot @@ -0,0 +1,327 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`comments type-assertion-regression-test.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 28, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 31, + ], + "type": "TSTypeAssertion", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 31, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 25, + ], + "type": "Line", + "value": " test", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrayLiteral/array-literal-in-lhs.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrayLiteral/array-literal-in-lhs.src.js.shot new file mode 100644 index 00000000000..554c83a56e0 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrayLiteral/array-literal-in-lhs.src.js.shot @@ -0,0 +1,364 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrayLiteral array-literal-in-lhs.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "object": Object { + "arguments": Array [ + Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 5, + ], + "type": "ArrayExpression", + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "fn", + "optional": false, + "range": Array [ + 0, + 2, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 6, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 0, + 8, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 14, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "obj", + "optional": false, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 2, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "value": "obj", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrayLiteral/array-literals-in-binary-expr.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrayLiteral/array-literals-in-binary-expr.src.js.shot new file mode 100644 index 00000000000..d88642ceb62 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrayLiteral/array-literals-in-binary-expr.src.js.shot @@ -0,0 +1,207 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrayLiteral array-literals-in-binary-expr.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 2, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "+", + "range": Array [ + 0, + 7, + ], + "right": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 7, + ], + "type": "ArrayExpression", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/as-param-with-params.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/as-param-with-params.src.js.shot new file mode 100644 index 00000000000..998c55131cc --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/as-param-with-params.src.js.shot @@ -0,0 +1,388 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions as-param-with-params.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 4, + 16, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 17, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 13, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/as-param.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/as-param.src.js.shot new file mode 100644 index 00000000000..a56eab70461 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/as-param.src.js.shot @@ -0,0 +1,291 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions as-param.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 4, + 12, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 13, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/basic-in-binary-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/basic-in-binary-expression.src.js.shot new file mode 100644 index 00000000000..2b28216e207 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/basic-in-binary-expression.src.js.shot @@ -0,0 +1,697 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions basic-in-binary-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 7, + 9, + ], + "type": "ObjectExpression", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 1, + 10, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "+", + "range": Array [ + 0, + 15, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "properties": Array [], + "range": Array [ + 25, + 27, + ], + "type": "ObjectExpression", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 19, + 28, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "operator": "+", + "range": Array [ + 18, + 33, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 17, + 35, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 5, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/basic.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/basic.src.js.shot new file mode 100644 index 00000000000..9fd9ec3be16 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/basic.src.js.shot @@ -0,0 +1,178 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions basic.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 12, + ], + "raw": "\\"test\\"", + "type": "Literal", + "value": "test", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 12, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 5, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 12, + ], + "type": "String", + "value": "\\"test\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/block-body-not-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/block-body-not-object.src.js.shot new file mode 100644 index 00000000000..f2188951eca --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/block-body-not-object.src.js.shot @@ -0,0 +1,329 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions block-body-not-object.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "body": Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "ExpressionStatement", + }, + "label": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "label", + "optional": false, + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 16, + ], + "type": "LabeledStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 18, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "e", + "optional": false, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 18, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 4, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + "value": "label", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/block-body.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/block-body.src.js.shot new file mode 100644 index 00000000000..34082fc3d30 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/block-body.src.js.shot @@ -0,0 +1,273 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions block-body.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 12, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "e", + "optional": false, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 12, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 4, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-dup-params.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-dup-params.src.js.shot new file mode 100644 index 00000000000..fa7ac3476f0 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-dup-params.src.js.shot @@ -0,0 +1,275 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions error-dup-params.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 12, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-default-param-eval.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-default-param-eval.src.js.shot new file mode 100644 index 00000000000..442810635e0 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-default-param-eval.src.js.shot @@ -0,0 +1,366 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions error-strict-default-param-eval.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "eval", + "optional": false, + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 15, + 24, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 14, + 31, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 32, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "value": "eval", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-dup-params.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-dup-params.src.js.shot new file mode 100644 index 00000000000..c49d8c299ba --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-dup-params.src.js.shot @@ -0,0 +1,348 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions error-strict-dup-params.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 14, + 26, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 27, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-eval-return.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-eval-return.src.js.shot new file mode 100644 index 00000000000..ec2906450b0 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-eval-return.src.js.shot @@ -0,0 +1,273 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions error-strict-eval-return.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "eval", + "optional": false, + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 14, + 26, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 26, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "value": "eval", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "Numeric", + "value": "42", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-eval.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-eval.src.js.shot new file mode 100644 index 00000000000..f268b518cad --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-eval.src.js.shot @@ -0,0 +1,346 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions error-strict-eval.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 24, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 25, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 30, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "eval", + "optional": false, + "range": Array [ + 1, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 30, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 5, + ], + "type": "Identifier", + "value": "eval", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 24, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-octal.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-octal.src.js.shot new file mode 100644 index 00000000000..ece03a5396a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-octal.src.js.shot @@ -0,0 +1,291 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions error-strict-octal.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "raw": "00", + "type": "Literal", + "value": 0, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 14, + 23, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 24, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "Numeric", + "value": "00", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-arguments.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-arguments.src.js.shot new file mode 100644 index 00000000000..159a3d7feed --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-arguments.src.js.shot @@ -0,0 +1,348 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions error-strict-param-arguments.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 34, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "arguments", + "optional": false, + "range": Array [ + 15, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 14, + 34, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 35, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 24, + ], + "type": "Identifier", + "value": "arguments", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 34, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-eval.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-eval.src.js.shot new file mode 100644 index 00000000000..07d22363882 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-eval.src.js.shot @@ -0,0 +1,348 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions error-strict-param-eval.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 29, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "eval", + "optional": false, + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 14, + 29, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 30, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "value": "eval", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 29, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-names.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-names.src.js.shot new file mode 100644 index 00000000000..b772330ff8c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-names.src.js.shot @@ -0,0 +1,348 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions error-strict-param-names.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 29, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "eval", + "optional": false, + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 14, + 29, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 30, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "value": "eval", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 29, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-no-paren-arguments.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-no-paren-arguments.src.js.shot new file mode 100644 index 00000000000..94626ddb831 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-no-paren-arguments.src.js.shot @@ -0,0 +1,255 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions error-strict-param-no-paren-arguments.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 29, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "arguments", + "optional": false, + "range": Array [ + 14, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 14, + 29, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 30, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 23, + ], + "type": "Identifier", + "value": "arguments", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 29, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-no-paren-eval.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-no-paren-eval.src.js.shot new file mode 100644 index 00000000000..31062099d02 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-strict-param-no-paren-eval.src.js.shot @@ -0,0 +1,255 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions error-strict-param-no-paren-eval.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "eval", + "optional": false, + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 14, + 24, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + "value": "eval", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-two-lines.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-two-lines.src.js.shot new file mode 100644 index 00000000000..e3aefbf0a54 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/error-two-lines.src.js.shot @@ -0,0 +1,274 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions error-two-lines.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 8, + 16, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/expression.src.js.shot new file mode 100644 index 00000000000..5c8f0d5dbf9 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/expression.src.js.shot @@ -0,0 +1,220 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions expression.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 1, + 7, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 5, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/iife.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/iife.src.js.shot new file mode 100644 index 00000000000..b519469a410 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/iife.src.js.shot @@ -0,0 +1,352 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions iife.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "property", + "optional": false, + "range": Array [ + 8, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 8, + 20, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + }, + ], + "range": Array [ + 6, + 22, + ], + "type": "ObjectExpression", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "e", + "optional": false, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 23, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 4, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 16, + ], + "type": "Identifier", + "value": "property", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/multiple-params.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/multiple-params.src.js.shot new file mode 100644 index 00000000000..6a4970cd86d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/multiple-params.src.js.shot @@ -0,0 +1,275 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions multiple-params.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "raw": "\\"test\\"", + "type": "Literal", + "value": "test", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 16, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "type": "String", + "value": "\\"test\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/no-auto-return.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/no-auto-return.src.js.shot new file mode 100644 index 00000000000..ca557bc8091 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/no-auto-return.src.js.shot @@ -0,0 +1,366 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions no-auto-return.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 17, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 17, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-arguments.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-arguments.src.js.shot new file mode 100644 index 00000000000..6c2ed960a1a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-arguments.src.js.shot @@ -0,0 +1,182 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions not-strict-arguments.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "arguments", + "optional": false, + "range": Array [ + 0, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 15, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Identifier", + "value": "arguments", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-eval-params.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-eval-params.src.js.shot new file mode 100644 index 00000000000..5212878a716 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-eval-params.src.js.shot @@ -0,0 +1,275 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions not-strict-eval-params.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "eval", + "optional": false, + "range": Array [ + 1, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 15, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 5, + ], + "type": "Identifier", + "value": "eval", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-eval.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-eval.src.js.shot new file mode 100644 index 00000000000..1e3c66af393 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-eval.src.js.shot @@ -0,0 +1,182 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions not-strict-eval.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 10, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "eval", + "optional": false, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 10, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "eval", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 7, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 10, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-octal.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-octal.src.js.shot new file mode 100644 index 00000000000..3a7aef2a4ca --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/not-strict-octal.src.js.shot @@ -0,0 +1,218 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions not-strict-octal.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "raw": "0o0", + "type": "Literal", + "value": 0, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 10, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 6, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Numeric", + "value": "0o0", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/return-arrow-function.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/return-arrow-function.src.js.shot new file mode 100644 index 00000000000..013339c5ed1 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/return-arrow-function.src.js.shot @@ -0,0 +1,264 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions return-arrow-function.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 5, + 12, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 12, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 4, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/return-sequence.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/return-sequence.src.js.shot new file mode 100644 index 00000000000..6a0e5199bed --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/return-sequence.src.js.shot @@ -0,0 +1,600 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions return-sequence.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "async": false, + "body": Object { + "expressions": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 26, + ], + "type": "SequenceExpression", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 8, + 27, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 28, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 6, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 17, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/single-param-parens.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/single-param-parens.src.js.shot new file mode 100644 index 00000000000..1ca178a95e6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/single-param-parens.src.js.shot @@ -0,0 +1,218 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions single-param-parens.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, + ], + "raw": "\\"test\\"", + "type": "Literal", + "value": "test", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "e", + "optional": false, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 13, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 6, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, + ], + "type": "String", + "value": "\\"test\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/single-param-return-identifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/single-param-return-identifier.src.js.shot new file mode 100644 index 00000000000..b91941a024a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/single-param-return-identifier.src.js.shot @@ -0,0 +1,220 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions single-param-return-identifier.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "earth", + "optional": false, + "range": Array [ + 9, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "sun", + "optional": false, + "range": Array [ + 1, + 4, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 14, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "Identifier", + "value": "sun", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Identifier", + "value": "earth", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/single-param.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/single-param.src.js.shot new file mode 100644 index 00000000000..787c7e574f8 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/arrowFunctions/single-param.src.js.shot @@ -0,0 +1,182 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript arrowFunctions single-param.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "raw": "\\"test\\"", + "type": "Literal", + "value": "test", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "e", + "optional": false, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 11, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 4, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "type": "String", + "value": "\\"test\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/and-operator-array-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/and-operator-array-object.src.js.shot new file mode 100644 index 00000000000..24c3a2164a6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/and-operator-array-object.src.js.shot @@ -0,0 +1,1855 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript basics and-operator-array-object.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "v", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "left": Object { + "left": Object { + "left": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 8, + 10, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "operator": "&&", + "range": Array [ + 8, + 16, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 14, + 16, + ], + "type": "ObjectExpression", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "operator": "&&", + "range": Array [ + 8, + 22, + ], + "right": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "ArrayExpression", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "operator": "&&", + "range": Array [ + 8, + 28, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "raw": "\\"\\"", + "type": "Literal", + "value": "", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "operator": "&&", + "range": Array [ + 8, + 42, + ], + "right": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 35, + ], + "raw": "\\"\\"", + "type": "Literal", + "value": "", + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "operator": "&&", + "range": Array [ + 33, + 41, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 39, + 41, + ], + "type": "ObjectExpression", + }, + "type": "LogicalExpression", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 42, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 48, + 49, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "left": Object { + "left": Object { + "left": Object { + "left": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 52, + 54, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "operator": "&&", + "range": Array [ + 52, + 60, + ], + "right": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 58, + 60, + ], + "type": "ArrayExpression", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "operator": "&&", + "range": Array [ + 52, + 66, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "properties": Array [], + "range": Array [ + 64, + 66, + ], + "type": "ObjectExpression", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "operator": "&&", + "range": Array [ + 52, + 72, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 70, + 72, + ], + "raw": "\\"\\"", + "type": "Literal", + "value": "", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "operator": "&&", + "range": Array [ + 52, + 86, + ], + "right": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 77, + 79, + ], + "raw": "\\"\\"", + "type": "Literal", + "value": "", + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "operator": "&&", + "range": Array [ + 77, + 85, + ], + "right": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 39, + "line": 2, + }, + }, + "range": Array [ + 83, + 85, + ], + "type": "ArrayExpression", + }, + "type": "LogicalExpression", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 48, + 86, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 44, + 87, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "left": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 96, + 98, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "operator": "&&", + "range": Array [ + 96, + 104, + ], + "right": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 102, + 104, + ], + "type": "ArrayExpression", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 92, + 104, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 88, + 105, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 110, + 111, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "properties": Array [], + "range": Array [ + 114, + 116, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "operator": "&&", + "range": Array [ + 114, + 122, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "properties": Array [], + "range": Array [ + 120, + 122, + ], + "type": "ObjectExpression", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 110, + 122, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 106, + 123, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 124, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "v", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 13, + ], + "type": "Punctuator", + "value": "&&", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 19, + ], + "type": "Punctuator", + "value": "&&", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "Punctuator", + "value": "&&", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "type": "String", + "value": "\\"\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "Punctuator", + "value": "&&", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 35, + ], + "type": "String", + "value": "\\"\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 38, + ], + "type": "Punctuator", + "value": "&&", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 44, + 47, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 55, + 57, + ], + "type": "Punctuator", + "value": "&&", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 61, + 63, + ], + "type": "Punctuator", + "value": "&&", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 67, + 69, + ], + "type": "Punctuator", + "value": "&&", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 70, + 72, + ], + "type": "String", + "value": "\\"\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 73, + 75, + ], + "type": "Punctuator", + "value": "&&", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 77, + 79, + ], + "type": "String", + "value": "\\"\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 80, + 82, + ], + "type": "Punctuator", + "value": "&&", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 2, + }, + "start": Object { + "column": 39, + "line": 2, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 40, + "line": 2, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 88, + 91, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 99, + 101, + ], + "type": "Punctuator", + "value": "&&", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 104, + 105, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 106, + 109, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 117, + 119, + ], + "type": "Punctuator", + "value": "&&", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 120, + 121, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 121, + 122, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 122, + 123, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/delete-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/delete-expression.src.js.shot new file mode 100644 index 00000000000..ea33bcb2b13 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/delete-expression.src.js.shot @@ -0,0 +1,215 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript basics delete-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 7, + 14, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "delete", + "prefix": true, + "range": Array [ + 0, + 14, + ], + "type": "UnaryExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "delete", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/do-while-statements.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/do-while-statements.src.js.shot new file mode 100644 index 00000000000..9ca5eda169a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/do-while-statements.src.js.shot @@ -0,0 +1,797 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript basics do-while-statements.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "EmptyStatement", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "DoWhileStatement", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "i", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 23, + 24, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 15, + 25, + ], + "type": "VariableDeclaration", + }, + Object { + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "name": "i", + "optional": false, + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "operator": "+=", + "range": Array [ + 34, + 40, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 39, + 40, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 29, + 43, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 26, + 58, + ], + "test": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "i", + "optional": false, + "range": Array [ + 51, + 52, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "operator": "<", + "range": Array [ + 51, + 56, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 55, + 56, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "type": "BinaryExpression", + }, + "type": "DoWhileStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 59, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 2, + ], + "type": "Keyword", + "value": "do", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 9, + ], + "type": "Keyword", + "value": "while", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 26, + 28, + ], + "type": "Keyword", + "value": "do", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 36, + 38, + ], + "type": "Punctuator", + "value": "+=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 44, + 49, + ], + "type": "Keyword", + "value": "while", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 15, + "line": 6, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/identifiers-double-underscore.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/identifiers-double-underscore.src.js.shot new file mode 100644 index 00000000000..cd84ca3b20b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/identifiers-double-underscore.src.js.shot @@ -0,0 +1,502 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript basics identifiers-double-underscore.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "__test", + "optional": false, + "range": Array [ + 4, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 17, + ], + "raw": "'ff'", + "type": "Literal", + "value": "ff", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 17, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 32, + 36, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "__Foo", + "optional": false, + "range": Array [ + 26, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 20, + 36, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 55, + 59, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "name": "__Bar", + "optional": false, + "range": Array [ + 47, + 52, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "params": Array [], + "range": Array [ + 38, + 59, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 60, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 10, + ], + "type": "Identifier", + "value": "__test", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 17, + ], + "type": "String", + "value": "'ff'", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 20, + 25, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 26, + 31, + ], + "type": "Identifier", + "value": "__Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 38, + 46, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "range": Array [ + 47, + 52, + ], + "type": "Identifier", + "value": "__Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 7, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/instanceof.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/instanceof.src.js.shot new file mode 100644 index 00000000000..9f636d412f1 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/instanceof.src.js.shot @@ -0,0 +1,157 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript basics instanceof.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 2, + ], + "raw": "''", + "type": "Literal", + "value": "", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "instanceof", + "range": Array [ + 0, + 17, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "Set", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 2, + ], + "type": "String", + "value": "''", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 13, + ], + "type": "Keyword", + "value": "instanceof", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "Set", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/new-with-member-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/new-with-member-expression.src.js.shot new file mode 100644 index 00000000000..d540f39388a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/new-with-member-expression.src.js.shot @@ -0,0 +1,251 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript basics new-with-member-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 4, + 11, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "NewExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/new-without-parens.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/new-without-parens.src.js.shot new file mode 100644 index 00000000000..a136fbdfdc9 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/new-without-parens.src.js.shot @@ -0,0 +1,310 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript basics new-without-parens.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 16, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 17, + 22, + ], + "type": "NewExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 17, + 23, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/or-operator-array-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/or-operator-array-object.src.js.shot new file mode 100644 index 00000000000..d880e34edf5 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/or-operator-array-object.src.js.shot @@ -0,0 +1,1855 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript basics or-operator-array-object.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "v", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "left": Object { + "left": Object { + "left": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 8, + 10, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "operator": "||", + "range": Array [ + 8, + 16, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 14, + 16, + ], + "type": "ObjectExpression", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "operator": "||", + "range": Array [ + 8, + 22, + ], + "right": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "ArrayExpression", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "operator": "||", + "range": Array [ + 8, + 28, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "raw": "\\"\\"", + "type": "Literal", + "value": "", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "operator": "||", + "range": Array [ + 8, + 42, + ], + "right": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 35, + ], + "raw": "\\"\\"", + "type": "Literal", + "value": "", + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "operator": "||", + "range": Array [ + 33, + 41, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 39, + 41, + ], + "type": "ObjectExpression", + }, + "type": "LogicalExpression", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 42, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 48, + 49, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "left": Object { + "left": Object { + "left": Object { + "left": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 52, + 54, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "operator": "||", + "range": Array [ + 52, + 60, + ], + "right": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 58, + 60, + ], + "type": "ArrayExpression", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "operator": "||", + "range": Array [ + 52, + 66, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "properties": Array [], + "range": Array [ + 64, + 66, + ], + "type": "ObjectExpression", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "operator": "||", + "range": Array [ + 52, + 72, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 70, + 72, + ], + "raw": "\\"\\"", + "type": "Literal", + "value": "", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "operator": "||", + "range": Array [ + 52, + 86, + ], + "right": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 77, + 79, + ], + "raw": "\\"\\"", + "type": "Literal", + "value": "", + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "operator": "||", + "range": Array [ + 77, + 85, + ], + "right": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 39, + "line": 2, + }, + }, + "range": Array [ + 83, + 85, + ], + "type": "ArrayExpression", + }, + "type": "LogicalExpression", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 48, + 86, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 44, + 87, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "left": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 96, + 98, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "operator": "||", + "range": Array [ + 96, + 104, + ], + "right": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 102, + 104, + ], + "type": "ArrayExpression", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 92, + 104, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 88, + 105, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 110, + 111, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "properties": Array [], + "range": Array [ + 114, + 116, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "operator": "||", + "range": Array [ + 114, + 122, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "properties": Array [], + "range": Array [ + 120, + 122, + ], + "type": "ObjectExpression", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 110, + 122, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 106, + 123, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 124, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "v", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 13, + ], + "type": "Punctuator", + "value": "||", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 19, + ], + "type": "Punctuator", + "value": "||", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "Punctuator", + "value": "||", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "type": "String", + "value": "\\"\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "Punctuator", + "value": "||", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 35, + ], + "type": "String", + "value": "\\"\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 38, + ], + "type": "Punctuator", + "value": "||", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 44, + 47, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 55, + 57, + ], + "type": "Punctuator", + "value": "||", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 61, + 63, + ], + "type": "Punctuator", + "value": "||", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 67, + 69, + ], + "type": "Punctuator", + "value": "||", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 70, + 72, + ], + "type": "String", + "value": "\\"\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 73, + 75, + ], + "type": "Punctuator", + "value": "||", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 77, + 79, + ], + "type": "String", + "value": "\\"\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 80, + 82, + ], + "type": "Punctuator", + "value": "||", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 2, + }, + "start": Object { + "column": 39, + "line": 2, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 40, + "line": 2, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 88, + 91, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 99, + 101, + ], + "type": "Punctuator", + "value": "||", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 104, + 105, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 106, + 109, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 117, + 119, + ], + "type": "Punctuator", + "value": "||", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 120, + 121, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 121, + 122, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 122, + 123, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/typeof-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/typeof-expression.src.js.shot new file mode 100644 index 00000000000..7478955678e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/typeof-expression.src.js.shot @@ -0,0 +1,119 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript basics typeof-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "raw": "'str'", + "type": "Literal", + "value": "str", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "typeof", + "prefix": true, + "range": Array [ + 0, + 12, + ], + "type": "UnaryExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "typeof", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "String", + "value": "'str'", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/update-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/update-expression.src.js.shot new file mode 100644 index 00000000000..38f46f64918 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/update-expression.src.js.shot @@ -0,0 +1,611 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript basics update-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "i", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 9, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "type": "VariableDeclaration", + }, + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "i", + "optional": false, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "operator": "++", + "prefix": false, + "range": Array [ + 28, + 31, + ], + "type": "UpdateExpression", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 28, + 32, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 24, + 34, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 11, + 34, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "optional": false, + "range": Array [ + 35, + 38, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 35, + 39, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 11, + 19, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "Punctuator", + "value": "++", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/basics/void-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/basics/void-expression.src.js.shot new file mode 100644 index 00000000000..bd4a10bb061 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/basics/void-expression.src.js.shot @@ -0,0 +1,283 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript basics void-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "void", + "prefix": true, + "range": Array [ + 0, + 6, + ], + "type": "UnaryExpression", + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 13, + 14, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "operator": "void", + "prefix": true, + "range": Array [ + 8, + 15, + ], + "type": "UnaryExpression", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 8, + 16, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 8, + 12, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/binary.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/binary.src.js.shot new file mode 100644 index 00000000000..4a8d4f331be --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/binary.src.js.shot @@ -0,0 +1,101 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript bigIntLiterals binary.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "bigint": "1", + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "raw": "0b1n", + "type": "Literal", + "value": 1n, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "0b1n", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/decimal.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/decimal.src.js.shot new file mode 100644 index 00000000000..bf56f2d96eb --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/decimal.src.js.shot @@ -0,0 +1,101 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript bigIntLiterals decimal.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "bigint": "1", + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 2, + ], + "raw": "1n", + "type": "Literal", + "value": 1n, + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 2, + ], + "type": "Identifier", + "value": "1n", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/hex.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/hex.src.js.shot new file mode 100644 index 00000000000..75125bb184e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/hex.src.js.shot @@ -0,0 +1,101 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript bigIntLiterals hex.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "bigint": "1", + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "raw": "0x1n", + "type": "Literal", + "value": 1n, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "0x1n", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/numeric-separator.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/numeric-separator.src.js.shot new file mode 100644 index 00000000000..3cd9533db4a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/numeric-separator.src.js.shot @@ -0,0 +1,101 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript bigIntLiterals numeric-separator.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "bigint": "123", + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "raw": "1_2_3n", + "type": "Literal", + "value": 123n, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Identifier", + "value": "1_2_3n", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/octal.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/octal.src.js.shot new file mode 100644 index 00000000000..52786883897 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/bigIntLiterals/octal.src.js.shot @@ -0,0 +1,101 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript bigIntLiterals octal.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "bigint": "1", + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "raw": "0o1n", + "type": "Literal", + "value": 1n, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "0o1n", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/binaryLiterals/lowercase.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/binaryLiterals/lowercase.src.js.shot new file mode 100644 index 00000000000..124bdb4cd05 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/binaryLiterals/lowercase.src.js.shot @@ -0,0 +1,100 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript binaryLiterals lowercase.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "raw": "0b101", + "type": "Literal", + "value": 5, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Numeric", + "value": "0b101", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/binaryLiterals/uppercase.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/binaryLiterals/uppercase.src.js.shot new file mode 100644 index 00000000000..3fa0b872adb --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/binaryLiterals/uppercase.src.js.shot @@ -0,0 +1,100 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript binaryLiterals uppercase.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "raw": "0B101", + "type": "Literal", + "value": 5, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Numeric", + "value": "0B101", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/blockBindings/const.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/blockBindings/const.src.js.shot new file mode 100644 index 00000000000..0e996dde2f1 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/blockBindings/const.src.js.shot @@ -0,0 +1,198 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript blockBindings const.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 15, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/blockBindings/let-in-switchcase.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/blockBindings/let-in-switchcase.src.js.shot new file mode 100644 index 00000000000..12070dc88d6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/blockBindings/let-in-switchcase.src.js.shot @@ -0,0 +1,490 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript blockBindings let-in-switchcase.src 1`] = ` +Object { + "body": Array [ + Object { + "cases": Array [ + Object { + "consequent": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "name": "t", + "optional": false, + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 37, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 38, + ], + "type": "VariableDeclaration", + }, + Object { + "label": null, + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 45, + ], + "type": "BreakStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 45, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "type": "SwitchCase", + }, + ], + "discriminant": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "answer", + "optional": false, + "range": Array [ + 8, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "type": "SwitchStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "switch", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 14, + ], + "type": "Identifier", + "value": "answer", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 22, + ], + "type": "Keyword", + "value": "case", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + "value": "t", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 37, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 44, + ], + "type": "Keyword", + "value": "break", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/blockBindings/let.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/blockBindings/let.src.js.shot new file mode 100644 index 00000000000..bc446c5e3d1 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/blockBindings/let.src.js.shot @@ -0,0 +1,198 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript blockBindings let.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 13, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/callExpression/call-expression-with-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/callExpression/call-expression-with-array.src.js.shot new file mode 100644 index 00000000000..3dddfc56a21 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/callExpression/call-expression-with-array.src.js.shot @@ -0,0 +1,213 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript callExpression call-expression-with-array.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 6, + ], + "type": "ArrayExpression", + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 7, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/callExpression/call-expression-with-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/callExpression/call-expression-with-object.src.js.shot new file mode 100644 index 00000000000..9089a7c7a3a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/callExpression/call-expression-with-object.src.js.shot @@ -0,0 +1,213 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript callExpression call-expression-with-object.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 4, + 6, + ], + "type": "ObjectExpression", + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 7, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/callExpression/mixed-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/callExpression/mixed-expression.src.js.shot new file mode 100644 index 00000000000..fb023683793 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/callExpression/mixed-expression.src.js.shot @@ -0,0 +1,973 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript callExpression mixed-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "properties": Array [], + "range": Array [ + 67, + 69, + ], + "type": "ObjectExpression", + }, + ], + "callee": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 59, + 61, + ], + "type": "ArrayExpression", + }, + ], + "callee": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "properties": Array [], + "range": Array [ + 46, + 48, + ], + "type": "ObjectExpression", + }, + Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 50, + 52, + ], + "type": "ArrayExpression", + }, + ], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 40, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "call", + "optional": false, + "range": Array [ + 41, + 45, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 36, + 45, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "optional": false, + "range": Array [ + 36, + 53, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 53, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 30, + 57, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 18, + 57, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 17, + 62, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 17, + 63, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 65, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 65, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 70, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 71, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 72, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 18, + 26, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 40, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 41, + 45, + ], + "type": "Identifier", + "value": "call", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/callExpression/new-expression-with-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/callExpression/new-expression-with-array.src.js.shot new file mode 100644 index 00000000000..30fb7745a51 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/callExpression/new-expression-with-array.src.js.shot @@ -0,0 +1,543 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript callExpression new-expression-with-array.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 10, + ], + "type": "ArrayExpression", + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "NewExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "elements": Array [ + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "properties": Array [], + "range": Array [ + 23, + 25, + ], + "type": "ObjectExpression", + }, + ], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 22, + 26, + ], + "type": "ArrayExpression", + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "ArrayExpression", + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 13, + 28, + ], + "type": "NewExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 13, + 29, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/callExpression/new-expression-with-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/callExpression/new-expression-with-object.src.js.shot new file mode 100644 index 00000000000..3b615a44ca9 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/callExpression/new-expression-with-object.src.js.shot @@ -0,0 +1,230 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript callExpression new-expression-with-object.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 8, + 10, + ], + "type": "ObjectExpression", + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "NewExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-accessor-properties.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-accessor-properties.src.js.shot new file mode 100644 index 00000000000..7eab8102766 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-accessor-properties.src.js.shot @@ -0,0 +1,650 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-accessor-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 9, + 18, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 14, + 18, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 19, + 29, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 29, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 24, + 29, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 31, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-computed-static-method.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-computed-static-method.src.js.shot new file mode 100644 index 00000000000..11524816612 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-computed-static-method.src.js.shot @@ -0,0 +1,449 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-computed-static-method.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": true, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 9, + 23, + ], + "static": true, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 19, + 23, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 25, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-expression.src.js.shot new file mode 100644 index 00000000000..d30272154a9 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-expression.src.js.shot @@ -0,0 +1,196 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": null, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 6, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-method-named-prototype.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-method-named-prototype.src.js.shot new file mode 100644 index 00000000000..432b691a259 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-method-named-prototype.src.js.shot @@ -0,0 +1,377 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-method-named-prototype.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "prototype", + "optional": false, + "range": Array [ + 9, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 9, + 22, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 18, + 22, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 23, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 18, + ], + "type": "Identifier", + "value": "prototype", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-method-named-static.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-method-named-static.src.js.shot new file mode 100644 index 00000000000..9eb3670aaa6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-method-named-static.src.js.shot @@ -0,0 +1,395 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-method-named-static.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "static", + "optional": false, + "range": Array [ + 9, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 9, + 19, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 19, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 15, + 19, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 21, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Identifier", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-method-named-with-space.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-method-named-with-space.src.js.shot new file mode 100644 index 00000000000..fa4567a5191 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-method-named-with-space.src.js.shot @@ -0,0 +1,342 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-method-named-with-space.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "withSpace", + "optional": false, + "range": Array [ + 9, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 9, + 24, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 19, + 24, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 25, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 18, + ], + "type": "Identifier", + "value": "withSpace", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-one-method-super.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-one-method-super.src.js.shot new file mode 100644 index 00000000000..434983b524c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-one-method-super.src.js.shot @@ -0,0 +1,505 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-one-method-super.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 41, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 27, + 32, + ], + "type": "Super", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "optional": false, + "range": Array [ + 27, + 34, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 27, + 35, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 41, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 15, + 41, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 43, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 27, + 32, + ], + "type": "Keyword", + "value": "super", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-one-method.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-one-method.src.js.shot new file mode 100644 index 00000000000..bcaecd13509 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-one-method.src.js.shot @@ -0,0 +1,377 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-one-method.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 19, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 19, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 15, + 19, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 21, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-accessor.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-accessor.src.js.shot new file mode 100644 index 00000000000..32d60d23aef --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-accessor.src.js.shot @@ -0,0 +1,1061 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-private-identifier-accessor.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "priv1", + "range": Array [ + 18, + 24, + ], + "type": "PrivateIdentifier", + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 39, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 37, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 39, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 24, + 39, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "priv1", + "range": Array [ + 46, + 52, + ], + "type": "PrivateIdentifier", + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 42, + 63, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 60, + 63, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "value", + "optional": false, + "range": Array [ + 53, + 58, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 52, + 63, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 67, + 78, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 67, + 107, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 87, + 91, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "priv1", + "range": Array [ + 92, + 98, + ], + "type": "PrivateIdentifier", + }, + "range": Array [ + 87, + 98, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "operator": "=", + "range": Array [ + 87, + 102, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 101, + 102, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 87, + 103, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 81, + 107, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "params": Array [], + "range": Array [ + 78, + 107, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 109, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 109, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 110, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 18, + 24, + ], + "type": "Identifier", + "value": "#priv1", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "Identifier", + "value": "#priv1", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 53, + 58, + ], + "type": "Identifier", + "value": "value", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 67, + 78, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 87, + 91, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 91, + 92, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 92, + 98, + ], + "type": "Identifier", + "value": "#priv1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 99, + 100, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 101, + 102, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-field.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-field.src.js.shot new file mode 100644 index 00000000000..9d71835526e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-field.src.js.shot @@ -0,0 +1,778 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-private-identifier-field.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "priv1", + "range": Array [ + 14, + 20, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 21, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": null, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "priv2", + "range": Array [ + 24, + 30, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 24, + 35, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 39, + 50, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 39, + 79, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 59, + 63, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "priv1", + "range": Array [ + 64, + 70, + ], + "type": "PrivateIdentifier", + }, + "range": Array [ + 59, + 70, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "operator": "=", + "range": Array [ + 59, + 74, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 73, + 74, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 59, + 75, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 53, + 79, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "params": Array [], + "range": Array [ + 50, + 79, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 81, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 81, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 82, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + "value": "#priv1", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 24, + 30, + ], + "type": "Identifier", + "value": "#priv2", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 39, + 50, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 59, + 63, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 64, + 70, + ], + "type": "Identifier", + "value": "#priv1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-method.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-method.src.js.shot new file mode 100644 index 00000000000..3420e9af1dd --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-private-identifier-method.src.js.shot @@ -0,0 +1,719 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-private-identifier-method.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "bar", + "range": Array [ + 14, + 18, + ], + "type": "PrivateIdentifier", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 23, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 18, + 23, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 27, + 38, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 27, + 63, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 47, + 51, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "name": "bar", + "range": Array [ + 52, + 56, + ], + "type": "PrivateIdentifier", + }, + "range": Array [ + 47, + 56, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "optional": false, + "range": Array [ + 47, + 58, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 47, + 59, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 41, + 63, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "params": Array [], + "range": Array [ + 38, + 63, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 65, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 66, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + "value": "#bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 27, + 38, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 47, + 51, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 52, + 56, + ], + "type": "Identifier", + "value": "#bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method-named-prototype.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method-named-prototype.src.js.shot new file mode 100644 index 00000000000..ba4b263d757 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method-named-prototype.src.js.shot @@ -0,0 +1,429 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-static-method-named-prototype.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": true, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 28, + ], + "raw": "\\"prototype\\"", + "type": "Literal", + "value": "prototype", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 9, + 33, + ], + "static": true, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 33, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 29, + 33, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 34, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 28, + ], + "type": "String", + "value": "\\"prototype\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method-named-static.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method-named-static.src.js.shot new file mode 100644 index 00000000000..782fe911f00 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method-named-static.src.js.shot @@ -0,0 +1,413 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-static-method-named-static.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "static", + "optional": false, + "range": Array [ + 16, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 9, + 26, + ], + "static": true, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 22, + 26, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 28, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Identifier", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method.src.js.shot new file mode 100644 index 00000000000..60f3ee16eaa --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-method.src.js.shot @@ -0,0 +1,413 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-static-method.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 9, + 21, + ], + "static": true, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 17, + 21, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 23, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-methods-and-accessor-properties.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-methods-and-accessor-properties.src.js.shot new file mode 100644 index 00000000000..fef551f8f4e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-static-methods-and-accessor-properties.src.js.shot @@ -0,0 +1,865 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-static-methods-and-accessor-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 9, + 21, + ], + "static": true, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 17, + 21, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 22, + 38, + ], + "static": true, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 38, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 34, + 38, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 51, + "line": 1, + }, + "start": Object { + "column": 50, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 39, + 56, + ], + "static": true, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 54, + "line": 1, + }, + }, + "range": Array [ + 54, + 56, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 52, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 51, + 56, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 58, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 58, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 58, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 58, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 1, + }, + "start": Object { + "column": 58, + "line": 1, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 59, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 59, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 45, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 49, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 1, + }, + "start": Object { + "column": 50, + "line": 1, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 52, + "line": 1, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 53, + "line": 1, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 54, + "line": 1, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 55, + "line": 1, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 1, + }, + "start": Object { + "column": 57, + "line": 1, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 1, + }, + "start": Object { + "column": 58, + "line": 1, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-computed-static-methods.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-computed-static-methods.src.js.shot new file mode 100644 index 00000000000..83bc9569d22 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-computed-static-methods.src.js.shot @@ -0,0 +1,682 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-two-computed-static-methods.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": true, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 9, + 22, + ], + "static": true, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 18, + 22, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": true, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 24, + 37, + ], + "static": true, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 37, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 33, + 37, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 38, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 30, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-computed-constructor.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-computed-constructor.src.js.shot new file mode 100644 index 00000000000..544d2ce7fdf --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-computed-constructor.src.js.shot @@ -0,0 +1,590 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-two-methods-computed-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 9, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 9, + 26, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 22, + 26, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": true, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 41, + ], + "raw": "\\"constructor\\"", + "type": "Literal", + "value": "constructor", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 27, + 46, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 46, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 42, + 46, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 47, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 22, + ], + "type": "String", + "value": "\\"constructor\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 41, + ], + "type": "String", + "value": "\\"constructor\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-semi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-semi.src.js.shot new file mode 100644 index 00000000000..fbb874c69f1 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-semi.src.js.shot @@ -0,0 +1,574 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-two-methods-semi.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 9, + 14, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 10, + 14, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 15, + 20, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 16, + 20, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 21, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-three-semi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-three-semi.src.js.shot new file mode 100644 index 00000000000..25e751448fa --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-three-semi.src.js.shot @@ -0,0 +1,610 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-two-methods-three-semi.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 10, + 15, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 11, + 15, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 16, + 21, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 17, + 21, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 23, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-two-semi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-two-semi.src.js.shot new file mode 100644 index 00000000000..9aa250dce24 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods-two-semi.src.js.shot @@ -0,0 +1,592 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-two-methods-two-semi.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 9, + 14, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 10, + 14, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 15, + 20, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 16, + 20, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 22, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods.src.js.shot new file mode 100644 index 00000000000..0e7540aea81 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-methods.src.js.shot @@ -0,0 +1,556 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-two-methods.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 9, + 14, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 10, + 14, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 19, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 19, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 15, + 19, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 20, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-static-methods-named-constructor.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-static-methods-named-constructor.src.js.shot new file mode 100644 index 00000000000..31d2a1296b6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-two-static-methods-named-constructor.src.js.shot @@ -0,0 +1,592 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-two-static-methods-named-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 16, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 9, + 31, + ], + "static": true, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 27, + 31, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 39, + 50, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 32, + 54, + ], + "static": true, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 52, + "line": 1, + }, + }, + "range": Array [ + 52, + 54, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 50, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 50, + 54, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 55, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 55, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 55, + "line": 1, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 27, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 50, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 1, + }, + "start": Object { + "column": 50, + "line": 1, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 52, + "line": 1, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 53, + "line": 1, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 54, + "line": 1, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 55, + "line": 1, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-constructor-parameters.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-constructor-parameters.src.js.shot new file mode 100644 index 00000000000..81d79860a13 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-constructor-parameters.src.js.shot @@ -0,0 +1,439 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-with-constructor-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 9, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 9, + 32, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 32, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 20, + 32, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 33, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 20, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-constructor-with-space.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-constructor-with-space.src.js.shot new file mode 100644 index 00000000000..ae4dd655a61 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-constructor-with-space.src.js.shot @@ -0,0 +1,377 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-with-constructor-with-space.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 9, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 9, + 25, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 21, + 25, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 26, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 20, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-constructor.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-constructor.src.js.shot new file mode 100644 index 00000000000..1db42bd6d31 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/class-with-constructor.src.js.shot @@ -0,0 +1,377 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes class-with-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 9, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 9, + 24, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 20, + 24, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 25, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 20, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/derived-class-assign-to-var.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/derived-class-assign-to-var.src.js.shot new file mode 100644 index 00000000000..3afca67d128 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/derived-class-assign-to-var.src.js.shot @@ -0,0 +1,348 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes derived-class-assign-to-var.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 27, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 27, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "superTypeParameters": undefined, + "type": "ClassExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 27, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 13, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/derived-class-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/derived-class-expression.src.js.shot new file mode 100644 index 00000000000..6e214373bd0 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/derived-class-expression.src.js.shot @@ -0,0 +1,250 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes derived-class-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": null, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 18, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "superTypeParameters": undefined, + "type": "ClassExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 6, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/empty-class-double-semi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/empty-class-double-semi.src.js.shot new file mode 100644 index 00000000000..bbe50c630e6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/empty-class-double-semi.src.js.shot @@ -0,0 +1,197 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes empty-class-double-semi.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 10, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/empty-class-semi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/empty-class-semi.src.js.shot new file mode 100644 index 00000000000..a91651fb18c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/empty-class-semi.src.js.shot @@ -0,0 +1,215 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes empty-class-semi.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/empty-class.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/empty-class.src.js.shot new file mode 100644 index 00000000000..07d6f1f4d68 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/empty-class.src.js.shot @@ -0,0 +1,197 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes empty-class.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 10, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/empty-literal-derived-class.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/empty-literal-derived-class.src.js.shot new file mode 100644 index 00000000000..35302c18682 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/empty-literal-derived-class.src.js.shot @@ -0,0 +1,251 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes empty-literal-derived-class.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 15, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/invalid-class-declaration.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/invalid-class-declaration.src.js.shot new file mode 100644 index 00000000000..45ab2064e11 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/invalid-class-declaration.src.js.shot @@ -0,0 +1,159 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes invalid-class-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": null, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/invalid-class-setter-declaration.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/invalid-class-setter-declaration.src.js.shot new file mode 100644 index 00000000000..d4f9e8a6db6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/invalid-class-setter-declaration.src.js.shot @@ -0,0 +1,395 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes invalid-class-setter-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 10, + 22, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 17, + 22, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 23, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/named-class-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/named-class-expression.src.js.shot new file mode 100644 index 00000000000..991a1291497 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/named-class-expression.src.js.shot @@ -0,0 +1,234 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes named-class-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 11, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 6, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/classes/named-derived-class-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/classes/named-derived-class-expression.src.js.shot new file mode 100644 index 00000000000..0f4a18c27e7 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/classes/named-derived-class-expression.src.js.shot @@ -0,0 +1,288 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript classes named-derived-class-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 20, + ], + "superClass": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "superTypeParameters": undefined, + "type": "ClassExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 6, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 16, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-conditional.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-conditional.src.js.shot new file mode 100644 index 00000000000..59249c85038 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-conditional.src.js.shot @@ -0,0 +1,474 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript commaOperator comma-operator-conditional.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "xx", + "optional": false, + "range": Array [ + 4, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "expressions": Array [ + Object { + "alternate": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "consequent": Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "operator": "++", + "prefix": false, + "range": Array [ + 15, + 18, + ], + "type": "UpdateExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 22, + ], + "test": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "xx", + "optional": false, + "range": Array [ + 10, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "ConditionalExpression", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 26, + ], + "type": "SequenceExpression", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 27, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 6, + ], + "type": "Identifier", + "value": "xx", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "Identifier", + "value": "xx", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Punctuator", + "value": "++", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-multi.src.js.shot new file mode 100644 index 00000000000..3e50b7b5813 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-multi.src.js.shot @@ -0,0 +1,581 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript commaOperator comma-operator-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "v1", + "optional": false, + "range": Array [ + 4, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "expressions": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "raw": "6", + "type": "Literal", + "value": 6, + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "raw": "7", + "type": "Literal", + "value": 7, + }, + ], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 29, + ], + "type": "SequenceExpression", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 30, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 6, + ], + "type": "Identifier", + "value": "v1", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Numeric", + "value": "6", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Numeric", + "value": "7", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-nested.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-nested.src.js.shot new file mode 100644 index 00000000000..8a71d3fafb8 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-nested.src.js.shot @@ -0,0 +1,691 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript commaOperator comma-operator-nested.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "v1", + "optional": false, + "range": Array [ + 4, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "expressions": Array [ + Object { + "expressions": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 18, + ], + "type": "SequenceExpression", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + Object { + "expressions": Array [ + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "raw": "6", + "type": "Literal", + "value": 6, + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "raw": "7", + "type": "Literal", + "value": 7, + }, + ], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 32, + ], + "type": "SequenceExpression", + }, + ], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 33, + ], + "type": "SequenceExpression", + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 34, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 6, + ], + "type": "Identifier", + "value": "v1", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Numeric", + "value": "6", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Numeric", + "value": "7", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-return.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-return.src.js.shot new file mode 100644 index 00000000000..6a4387cf635 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-return.src.js.shot @@ -0,0 +1,593 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript commaOperator comma-operator-return.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 22, + 27, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 28, + ], + "type": "VariableDeclaration", + }, + Object { + "argument": Object { + "expressions": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "name": "v1", + "optional": false, + "range": Array [ + 41, + 43, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 38, + 46, + ], + "type": "SequenceExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 31, + 47, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 49, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f1", + "optional": false, + "range": Array [ + 9, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 49, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Identifier", + "value": "f1", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 41, + 43, + ], + "type": "Identifier", + "value": "v1", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-simple-nested.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-simple-nested.src.js.shot new file mode 100644 index 00000000000..e1bfdf3c2d1 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-simple-nested.src.js.shot @@ -0,0 +1,378 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript commaOperator comma-operator-simple-nested.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "expressions": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 19, + ], + "type": "SequenceExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 22, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-simple.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-simple.src.js.shot new file mode 100644 index 00000000000..d7f1c274092 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/commaOperator/comma-operator-simple.src.js.shot @@ -0,0 +1,232 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript commaOperator comma-operator-simple.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 15, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/defaultParams/class-constructor.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/class-constructor.src.js.shot new file mode 100644 index 00000000000..3569cb9eb84 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/class-constructor.src.js.shot @@ -0,0 +1,457 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript defaultParams class-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 44, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 37, + 44, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 26, + 35, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 35, + ], + "raw": "'bar'", + "type": "Literal", + "value": "bar", + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 25, + 44, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 46, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 46, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 35, + ], + "type": "String", + "value": "'bar'", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/defaultParams/class-method.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/class-method.src.js.shot new file mode 100644 index 00000000000..57fcb198f6f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/class-method.src.js.shot @@ -0,0 +1,457 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript defaultParams class-method.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 36, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 36, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 18, + 27, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 27, + ], + "raw": "'baz'", + "type": "Literal", + "value": "baz", + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 17, + 36, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 38, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 27, + ], + "type": "String", + "value": "'baz'", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/defaultParams/declaration.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/declaration.src.js.shot new file mode 100644 index 00000000000..8e72eeee0c5 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/declaration.src.js.shot @@ -0,0 +1,313 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript defaultParams declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 11, + 16, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 20, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/defaultParams/expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/expression.src.js.shot new file mode 100644 index 00000000000..a36ce0253ea --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/expression.src.js.shot @@ -0,0 +1,368 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript defaultParams expression.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 22, + ], + "right": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 13, + 18, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 4, + 22, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 12, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/defaultParams/method.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/method.src.js.shot new file mode 100644 index 00000000000..ad60d4f5c4a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/method.src.js.shot @@ -0,0 +1,502 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript defaultParams method.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 27, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 6, + 25, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 18, + 21, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 9, + 25, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "range": Array [ + 4, + 27, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 17, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/defaultParams/not-all-params.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/not-all-params.src.js.shot new file mode 100644 index 00000000000..a8eac5b333d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/defaultParams/not-all-params.src.js.shot @@ -0,0 +1,521 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript defaultParams not-all-params.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 35, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 22, + 28, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 10, + 35, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 35, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 18, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-array.src.js.shot new file mode 100644 index 00000000000..b5870a1cbee --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-array.src.js.shot @@ -0,0 +1,278 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-arrowFunctions arrow-param-array.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 1, + 4, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 10, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js.shot new file mode 100644 index 00000000000..715917e932c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-nested-array.src.js.shot @@ -0,0 +1,393 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-arrowFunctions arrow-param-nested-array.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 1, + 9, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 15, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 13, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js.shot new file mode 100644 index 00000000000..ad26763f052 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object-named.src.js.shot @@ -0,0 +1,630 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-arrowFunctions arrow-param-nested-object-named.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 2, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 2, + 8, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 10, + 20, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 13, + 19, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 12, + 20, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 1, + 21, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 27, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 5, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js.shot new file mode 100644 index 00000000000..d34a19fcefd --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-nested-object.src.js.shot @@ -0,0 +1,558 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-arrowFunctions arrow-param-nested-object.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 2, + 3, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 5, + 10, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 8, + 9, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 7, + 10, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 1, + 11, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 17, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-object.src.js.shot new file mode 100644 index 00000000000..e3302567feb --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/arrow-param-object.src.js.shot @@ -0,0 +1,321 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-arrowFunctions arrow-param-object.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 2, + 3, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 1, + 4, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 10, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/param-defaults-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/param-defaults-array.src.js.shot new file mode 100644 index 00000000000..1aa480a1b1d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/param-defaults-array.src.js.shot @@ -0,0 +1,335 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-arrowFunctions param-defaults-array.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 2, + 8, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 1, + 9, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 15, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 13, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "x", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js.shot new file mode 100644 index 00000000000..1c000de2ad3 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/param-defaults-object-nested.src.js.shot @@ -0,0 +1,802 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-arrowFunctions param-defaults-object-nested.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "ArrayExpression", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 2, + 8, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 2, + 8, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 10, + 23, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 15, + 21, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 15, + 21, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 13, + 23, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 1, + 24, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 35, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "]", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/param-defaults-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/param-defaults-object.src.js.shot new file mode 100644 index 00000000000..f60c58a80fb --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-arrowFunctions/param-defaults-object.src.js.shot @@ -0,0 +1,378 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-arrowFunctions param-defaults-object.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 2, + 8, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 2, + 8, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 1, + 9, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 15, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 13, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "x", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/array-const-undefined.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/array-const-undefined.src.js.shot new file mode 100644 index 00000000000..15d77d2373a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/array-const-undefined.src.js.shot @@ -0,0 +1,271 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-blockBindings array-const-undefined.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/array-let-undefined.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/array-let-undefined.src.js.shot new file mode 100644 index 00000000000..fb391ec1034 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/array-let-undefined.src.js.shot @@ -0,0 +1,271 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-blockBindings array-let-undefined.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 4, + 7, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 12, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-const-named.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-const-named.src.js.shot new file mode 100644 index 00000000000..3ae7f324881 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-const-named.src.js.shot @@ -0,0 +1,350 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-blockBindings object-const-named.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 7, + 10, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 6, + 11, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 14, + 16, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-const-undefined.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-const-undefined.src.js.shot new file mode 100644 index 00000000000..8a35c324221 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-const-undefined.src.js.shot @@ -0,0 +1,314 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-blockBindings object-const-undefined.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 7, + 8, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 6, + 9, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 12, + 14, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-let-named.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-let-named.src.js.shot new file mode 100644 index 00000000000..7b1922e8ff4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-let-named.src.js.shot @@ -0,0 +1,350 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-blockBindings object-let-named.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 5, + 8, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 4, + 9, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 12, + 14, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-let-undefined.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-let-undefined.src.js.shot new file mode 100644 index 00000000000..0be2c7d8a08 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-blockBindings/object-let-undefined.src.js.shot @@ -0,0 +1,314 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-blockBindings object-let-undefined.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 5, + 6, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 4, + 7, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 10, + 12, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 12, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-array.src.js.shot new file mode 100644 index 00000000000..1c22d9dab39 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-array.src.js.shot @@ -0,0 +1,461 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-defaultParams param-array.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 11, + 14, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 11, + 20, + ], + "right": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + ], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "ArrayExpression", + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 24, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-object-short.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-object-short.src.js.shot new file mode 100644 index 00000000000..99d9795d417 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-object-short.src.js.shot @@ -0,0 +1,680 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-defaultParams param-object-short.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": true, + "optional": false, + "range": Array [ + 2, + 21, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 5, + 6, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 4, + 7, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 4, + 17, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 11, + 16, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + }, + ], + "range": Array [ + 10, + 17, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 3, + 21, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "range": Array [ + 1, + 22, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-object-wrapped.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-object-wrapped.src.js.shot new file mode 100644 index 00000000000..af7a2368808 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-object-wrapped.src.js.shot @@ -0,0 +1,716 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-defaultParams param-object-wrapped.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 2, + 31, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 15, + 16, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 14, + 17, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 14, + 27, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 21, + 26, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + }, + ], + "range": Array [ + 20, + 27, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 5, + 31, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "range": Array [ + 1, + 32, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 13, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-object.src.js.shot new file mode 100644 index 00000000000..d3b0511fe86 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-defaultParams/param-object.src.js.shot @@ -0,0 +1,621 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-defaultParams param-object.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 30, + ], + "right": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 30, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 14, + 15, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 13, + 16, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 13, + 26, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 20, + 25, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + }, + ], + "range": Array [ + 19, + 26, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 4, + 30, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 12, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-forOf/loop.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-forOf/loop.src.js.shot new file mode 100644 index 00000000000..9035479de39 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-forOf/loop.src.js.shot @@ -0,0 +1,288 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-forOf loop.src 1`] = ` +Object { + "body": Array [ + Object { + "await": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "EmptyStatement", + }, + "left": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "ForOfStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Identifier", + "value": "of", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/complex-destructured.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/complex-destructured.src.js.shot new file mode 100644 index 00000000000..fe9333adb32 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/complex-destructured.src.js.shot @@ -0,0 +1,532 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-spread complex-destructured.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 3, + 4, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 6, + 7, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 1, + 9, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 11, + 15, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 16, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 20, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "d", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/destructured-array-literal.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/destructured-array-literal.src.js.shot new file mode 100644 index 00000000000..f87059bfb1a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/destructured-array-literal.src.js.shot @@ -0,0 +1,446 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-spread destructured-array-literal.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "argument": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 7, + 13, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 4, + 13, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 14, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 18, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "d", + "optional": false, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/destructuring-param.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/destructuring-param.src.js.shot new file mode 100644 index 00000000000..e7c4c0e8a6c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/destructuring-param.src.js.shot @@ -0,0 +1,542 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-spread destructuring-param.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 30, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "argument": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "ok", + "optional": false, + "range": Array [ + 22, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 21, + 25, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 18, + 25, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 11, + 26, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 30, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "Identifier", + "value": "ok", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/error-complex-destructured-spread-first.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/error-complex-destructured-spread-first.src.js.shot new file mode 100644 index 00000000000..f5983c69db4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/error-complex-destructured-spread-first.src.js.shot @@ -0,0 +1,532 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-spread error-complex-destructured-spread-first.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "elements": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 1, + 5, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 9, + 10, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 12, + 13, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 7, + 15, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 16, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 20, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "d", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/invalid-not-final-array-empty.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/invalid-not-final-array-empty.src.js.shot new file mode 100644 index 00000000000..ac972ba6538 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/invalid-not-final-array-empty.src.js.shot @@ -0,0 +1,292 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-spread invalid-not-final-array-empty.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "elements": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 1, + 5, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 8, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 12, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/multi-destructured.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/multi-destructured.src.js.shot new file mode 100644 index 00000000000..099813077c4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/multi-destructured.src.js.shot @@ -0,0 +1,331 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-spread multi-destructured.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 4, + 8, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 9, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 13, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/not-final-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/not-final-array.src.js.shot new file mode 100644 index 00000000000..91a7755e6e9 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/not-final-array.src.js.shot @@ -0,0 +1,331 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-spread not-final-array.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "elements": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 1, + 5, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 9, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 13, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/single-destructured.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/single-destructured.src.js.shot new file mode 100644 index 00000000000..c84486fea60 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/single-destructured.src.js.shot @@ -0,0 +1,274 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-spread single-destructured.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "elements": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 1, + 5, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 6, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 10, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-complex-destructured.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-complex-destructured.src.js.shot new file mode 100644 index 00000000000..8fdea157a80 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-complex-destructured.src.js.shot @@ -0,0 +1,553 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-spread var-complex-destructured.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 7, + 8, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 10, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 5, + 13, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 15, + 19, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 4, + 20, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "d", + "optional": false, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 24, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-destructured-array-literal.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-destructured-array-literal.src.js.shot new file mode 100644 index 00000000000..82a555745aa --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-destructured-array-literal.src.js.shot @@ -0,0 +1,467 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-spread var-destructured-array-literal.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "argument": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 11, + 17, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 8, + 17, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 4, + 18, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "d", + "optional": false, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-multi-destructured.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-multi-destructured.src.js.shot new file mode 100644 index 00000000000..3784815c474 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-multi-destructured.src.js.shot @@ -0,0 +1,352 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-spread var-multi-destructured.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 8, + 12, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 4, + 13, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 17, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-single-destructured.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-single-destructured.src.js.shot new file mode 100644 index 00000000000..cfe2fe744c8 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring-and-spread/var-single-destructured.src.js.shot @@ -0,0 +1,295 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring-and-spread var-single-destructured.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "elements": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 5, + 9, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 4, + 10, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/array-member.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/array-member.src.js.shot new file mode 100644 index 00000000000..11880e217c0 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/array-member.src.js.shot @@ -0,0 +1,309 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring array-member.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "elements": Array [ + Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "ok", + "optional": false, + "range": Array [ + 1, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "v", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 1, + 5, + ], + "type": "MemberExpression", + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 6, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "20", + "type": "Literal", + "value": 20, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 3, + ], + "type": "Identifier", + "value": "ok", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "v", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "20", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/array-to-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/array-to-array.src.js.shot new file mode 100644 index 00000000000..2b27d36e315 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/array-to-array.src.js.shot @@ -0,0 +1,404 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring array-to-array.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 6, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 15, + ], + "right": Object { + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "ArrayExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/array-var-undefined.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/array-var-undefined.src.js.shot new file mode 100644 index 00000000000..e00d1424175 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/array-var-undefined.src.js.shot @@ -0,0 +1,271 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring array-var-undefined.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 4, + 7, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 12, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/call-expression-destruction-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/call-expression-destruction-array.src.js.shot new file mode 100644 index 00000000000..e1b236b05d2 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/call-expression-destruction-array.src.js.shot @@ -0,0 +1,248 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring call-expression-destruction-array.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "argument": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 9, + ], + "type": "SpreadElement", + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 10, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/call-expression-destruction-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/call-expression-destruction-object.src.js.shot new file mode 100644 index 00000000000..0ef44c61653 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/call-expression-destruction-object.src.js.shot @@ -0,0 +1,248 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring call-expression-destruction-object.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 7, + 9, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 9, + ], + "type": "SpreadElement", + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 10, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-array.src.js.shot new file mode 100644 index 00000000000..3494762e712 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-array.src.js.shot @@ -0,0 +1,497 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring class-constructor-params-array.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "consturctor", + "optional": false, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 45, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 38, + 45, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 26, + 36, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 25, + 45, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 47, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "consturctor", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-defaults-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-defaults-array.src.js.shot new file mode 100644 index 00000000000..1e48387e524 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-defaults-array.src.js.shot @@ -0,0 +1,647 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring class-constructor-params-defaults-array.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "consturctor", + "optional": false, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 49, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 42, + 49, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 27, + 32, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 34, + 39, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 26, + 40, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 25, + 49, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 51, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "consturctor", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-defaults-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-defaults-object.src.js.shot new file mode 100644 index 00000000000..89d7bec8ca1 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-defaults-object.src.js.shot @@ -0,0 +1,733 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring class-constructor-params-defaults-object.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "consturctor", + "optional": false, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 49, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 42, + 49, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 27, + 32, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 27, + 32, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 34, + 39, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 34, + 39, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 26, + 40, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 25, + 49, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 51, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "consturctor", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-object.src.js.shot new file mode 100644 index 00000000000..99ce9fb349b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-constructor-params-object.src.js.shot @@ -0,0 +1,583 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring class-constructor-params-object.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "consturctor", + "optional": false, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 45, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 38, + 45, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 27, + 30, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 32, + 35, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 26, + 36, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 25, + 45, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 47, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "consturctor", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-array.src.js.shot new file mode 100644 index 00000000000..a5727b567b5 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-array.src.js.shot @@ -0,0 +1,497 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring class-method-params-array.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 37, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 37, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 18, + 28, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 17, + 37, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 39, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-defaults-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-defaults-array.src.js.shot new file mode 100644 index 00000000000..d0bed90500b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-defaults-array.src.js.shot @@ -0,0 +1,647 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring class-method-params-defaults-array.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 41, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 19, + 24, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 26, + 31, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 18, + 32, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 17, + 41, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 43, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-defaults-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-defaults-object.src.js.shot new file mode 100644 index 00000000000..381638adf40 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-defaults-object.src.js.shot @@ -0,0 +1,733 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring class-method-params-defaults-object.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 41, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 19, + 24, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 19, + 24, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 26, + 31, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 26, + 31, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 18, + 32, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 17, + 41, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 43, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-object.src.js.shot new file mode 100644 index 00000000000..f48e895e4c4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/class-method-params-object.src.js.shot @@ -0,0 +1,583 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring class-method-params-object.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 37, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 37, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 19, + 22, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 24, + 27, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 18, + 28, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 17, + 37, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 39, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-all.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-all.src.js.shot new file mode 100644 index 00000000000..2f0a156c13e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-all.src.js.shot @@ -0,0 +1,595 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring defaults-array-all.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 13, + 18, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 20, + 25, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 4, + 26, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 30, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-longform-nested-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-longform-nested-multi.src.js.shot new file mode 100644 index 00000000000..a07485a07c6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-longform-nested-multi.src.js.shot @@ -0,0 +1,819 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring defaults-array-longform-nested-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 5, + 9, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 11, + 15, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 17, + 32, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 22, + 31, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 25, + 31, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 20, + 32, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 4, + 34, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 38, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-multi.src.js.shot new file mode 100644 index 00000000000..324a1a13603 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-multi.src.js.shot @@ -0,0 +1,445 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring defaults-array-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 4, + 18, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-nested-all.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-nested-all.src.js.shot new file mode 100644 index 00000000000..755ecabd3e8 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-nested-all.src.js.shot @@ -0,0 +1,521 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring defaults-array-nested-all.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 15, + 21, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 13, + 22, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 4, + 23, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 27, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-nested-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-nested-multi.src.js.shot new file mode 100644 index 00000000000..0959f81fd93 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array-nested-multi.src.js.shot @@ -0,0 +1,446 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring defaults-array-nested-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 13, + 18, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 4, + 19, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 23, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array.src.js.shot new file mode 100644 index 00000000000..eefedac7104 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-array.src.js.shot @@ -0,0 +1,292 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring defaults-array.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 1, + 5, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 5, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 6, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 10, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 5, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-all.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-all.src.js.shot new file mode 100644 index 00000000000..d645ed370b2 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-all.src.js.shot @@ -0,0 +1,724 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring defaults-object-all.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 5, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 13, + 18, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 13, + 18, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 20, + 25, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 20, + 25, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 4, + 26, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 30, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-assign.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-assign.src.js.shot new file mode 100644 index 00000000000..ea08a63ea0b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-assign.src.js.shot @@ -0,0 +1,561 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring defaults-object-assign.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "Object", + "optional": false, + "range": Array [ + 3, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 3, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "Object", + "optional": false, + "range": Array [ + 3, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 3, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "String", + "optional": false, + "range": Array [ + 13, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 13, + 21, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "String", + "optional": false, + "range": Array [ + 13, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 13, + 21, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 1, + 23, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 1, + 28, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 26, + 28, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 9, + ], + "type": "Identifier", + "value": "Object", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 19, + ], + "type": "Identifier", + "value": "String", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-longform-all.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-longform-all.src.js.shot new file mode 100644 index 00000000000..62fddc0d7d9 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-longform-all.src.js.shot @@ -0,0 +1,832 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring defaults-object-longform-all.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 5, + 14, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 8, + 14, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 16, + 25, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 19, + 25, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 27, + 36, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 30, + 36, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 36, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 4, + 37, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 41, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 36, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-longform-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-longform-multi.src.js.shot new file mode 100644 index 00000000000..ff2664d772a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-longform-multi.src.js.shot @@ -0,0 +1,682 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring defaults-object-longform-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 5, + 9, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 11, + 20, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 14, + 20, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 22, + 26, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 4, + 27, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 31, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-longform.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-longform.src.js.shot new file mode 100644 index 00000000000..09bad9cf65d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-longform.src.js.shot @@ -0,0 +1,410 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring defaults-object-longform.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 6, + 15, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 9, + 15, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 4, + 17, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 21, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-mixed-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-mixed-multi.src.js.shot new file mode 100644 index 00000000000..29554cdc9cc --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-mixed-multi.src.js.shot @@ -0,0 +1,610 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring defaults-object-mixed-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 5, + 6, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 8, + 17, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 11, + 17, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 17, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 19, + 20, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 4, + 21, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 25, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 17, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-multi.src.js.shot new file mode 100644 index 00000000000..d943686cc18 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-multi.src.js.shot @@ -0,0 +1,574 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring defaults-object-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 5, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 13, + 14, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 16, + 17, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 4, + 18, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-nested-all.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-nested-all.src.js.shot new file mode 100644 index 00000000000..9792670e0ad --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-nested-all.src.js.shot @@ -0,0 +1,686 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring defaults-object-nested-all.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 5, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 13, + 25, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 18, + 24, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 18, + 24, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 16, + 25, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 4, + 26, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 30, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-nested-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-nested-multi.src.js.shot new file mode 100644 index 00000000000..b6257ee5a44 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object-nested-multi.src.js.shot @@ -0,0 +1,611 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring defaults-object-nested-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 5, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 13, + 21, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 18, + 19, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 16, + 21, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 4, + 22, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 26, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object.src.js.shot new file mode 100644 index 00000000000..5d59d252a3a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/defaults-object.src.js.shot @@ -0,0 +1,356 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring defaults-object.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 5, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 5, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 4, + 12, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "x", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/destructured-array-catch.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/destructured-array-catch.src.js.shot new file mode 100644 index 00000000000..f0d9beb6ffa --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/destructured-array-catch.src.js.shot @@ -0,0 +1,960 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring destructured-array-catch.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "block": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 35, + 36, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 34, + 37, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 30, + 42, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 24, + 46, + ], + "type": "BlockStatement", + }, + "finalizer": null, + "handler": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 64, + 69, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "param": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "name": "stack", + "optional": false, + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "optional": false, + "range": Array [ + 55, + 62, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "range": Array [ + 49, + 69, + ], + "type": "CatchClause", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 20, + 69, + ], + "type": "TryStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 71, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 12, + 13, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 11, + 14, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 71, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 72, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "Keyword", + "value": "try", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 30, + 33, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 49, + 54, + ], + "type": "Keyword", + "value": "catch", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + "value": "stack", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/destructured-object-catch.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/destructured-object-catch.src.js.shot new file mode 100644 index 00000000000..99f124469b6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/destructured-object-catch.src.js.shot @@ -0,0 +1,1003 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring destructured-object-catch.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "block": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 35, + 36, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 34, + 37, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 30, + 42, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 24, + 46, + ], + "type": "BlockStatement", + }, + "finalizer": null, + "handler": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 64, + 69, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "param": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "name": "stack", + "optional": false, + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 56, + 61, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "name": "stack", + "optional": false, + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 55, + 62, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "range": Array [ + 49, + 69, + ], + "type": "CatchClause", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 20, + 69, + ], + "type": "TryStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 71, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 12, + 13, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 11, + 14, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 71, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 72, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "Keyword", + "value": "try", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 30, + 33, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 49, + 54, + ], + "type": "Keyword", + "value": "catch", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + "value": "stack", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/invalid-defaults-object-assign.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/invalid-defaults-object-assign.src.js.shot new file mode 100644 index 00000000000..f23ecdeefb5 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/invalid-defaults-object-assign.src.js.shot @@ -0,0 +1,558 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring invalid-defaults-object-assign.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "Object", + "optional": false, + "range": Array [ + 3, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 3, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "Object", + "optional": false, + "range": Array [ + 3, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 3, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "String", + "optional": false, + "range": Array [ + 13, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 13, + 21, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "String", + "optional": false, + "range": Array [ + 13, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 13, + 21, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 1, + 23, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 29, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 27, + 29, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 9, + ], + "type": "Identifier", + "value": "Object", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 19, + ], + "type": "Identifier", + "value": "String", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/named-param.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/named-param.src.js.shot new file mode 100644 index 00000000000..873f710042d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/named-param.src.js.shot @@ -0,0 +1,350 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring named-param.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "responseText", + "optional": false, + "range": Array [ + 3, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 3, + 21, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "text", + "optional": false, + "range": Array [ + 17, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 1, + 23, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 1, + 29, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "res", + "optional": false, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 15, + ], + "type": "Identifier", + "value": "responseText", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "Identifier", + "value": "text", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "res", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/nested-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/nested-array.src.js.shot new file mode 100644 index 00000000000..c970f3dbf8d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/nested-array.src.js.shot @@ -0,0 +1,682 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring nested-array.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + null, + Object { + "decorators": Array [], + "elements": Array [ + null, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 10, + 15, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 4, + 16, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + ], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 29, + ], + "type": "ArrayExpression", + }, + ], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 30, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 30, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/nested-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/nested-object.src.js.shot new file mode 100644 index 00000000000..2b2864dce2e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/nested-object.src.js.shot @@ -0,0 +1,1008 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring nested-object.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 5, + 9, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 11, + 22, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 16, + 20, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 14, + 22, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 4, + 24, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 29, + 35, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 35, + ], + "raw": "\\"3\\"", + "type": "Literal", + "value": "3", + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 37, + 50, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 42, + 48, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 48, + ], + "raw": "\\"b\\"", + "type": "Literal", + "value": "b", + }, + }, + ], + "range": Array [ + 40, + 50, + ], + "type": "ObjectExpression", + }, + }, + ], + "range": Array [ + 27, + 52, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 52, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 53, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 53, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "String", + "value": "\\"3\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 48, + ], + "type": "String", + "value": "\\"b\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 52, + "line": 1, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/object-var-named.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/object-var-named.src.js.shot new file mode 100644 index 00000000000..1570468dbf0 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/object-var-named.src.js.shot @@ -0,0 +1,350 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring object-var-named.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 5, + 8, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 4, + 9, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 12, + 14, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/object-var-undefined.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/object-var-undefined.src.js.shot new file mode 100644 index 00000000000..4ca1b8678f1 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/object-var-undefined.src.js.shot @@ -0,0 +1,314 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring object-var-undefined.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 5, + 6, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 4, + 7, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 10, + 12, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 12, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/param-defaults-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/param-defaults-array.src.js.shot new file mode 100644 index 00000000000..79f9a2d3f75 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/param-defaults-array.src.js.shot @@ -0,0 +1,371 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring param-defaults-array.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 12, + 18, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 11, + 19, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 23, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/param-defaults-object-nested.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/param-defaults-object-nested.src.js.shot new file mode 100644 index 00000000000..b624bab2286 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/param-defaults-object-nested.src.js.shot @@ -0,0 +1,761 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring param-defaults-object-nested.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 38, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 12, + 18, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 12, + 18, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 20, + 33, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 25, + 31, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 25, + 31, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 23, + 33, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 11, + 34, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 38, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/param-defaults-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/param-defaults-object.src.js.shot new file mode 100644 index 00000000000..27805974e8f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/param-defaults-object.src.js.shot @@ -0,0 +1,414 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring param-defaults-object.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 12, + 18, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 12, + 18, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 11, + 19, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 23, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-array-wrapped.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-array-wrapped.src.js.shot new file mode 100644 index 00000000000..95477c0b142 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-array-wrapped.src.js.shot @@ -0,0 +1,425 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring params-array-wrapped.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 12, + 20, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 1, + 23, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-array.src.js.shot new file mode 100644 index 00000000000..b1464adf09d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-array.src.js.shot @@ -0,0 +1,388 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring params-array.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 11, + 19, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 22, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-multi-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-multi-object.src.js.shot new file mode 100644 index 00000000000..e99c0eacc7b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-multi-object.src.js.shot @@ -0,0 +1,431 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring params-multi-object.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 16, + 17, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 14, + 19, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 22, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-nested-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-nested-array.src.js.shot new file mode 100644 index 00000000000..497ac3b53f4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-nested-array.src.js.shot @@ -0,0 +1,484 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring params-nested-array.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 27, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + null, + Object { + "decorators": Array [], + "elements": Array [ + null, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 17, + 22, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 11, + 23, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 27, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-nested-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-nested-object.src.js.shot new file mode 100644 index 00000000000..d2f8056302b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-nested-object.src.js.shot @@ -0,0 +1,683 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring params-nested-object.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 35, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 12, + 16, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 18, + 29, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 23, + 27, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 21, + 29, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 11, + 31, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 35, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-object-wrapped.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-object-wrapped.src.js.shot new file mode 100644 index 00000000000..18a48d95ed3 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-object-wrapped.src.js.shot @@ -0,0 +1,511 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring params-object-wrapped.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 14, + 15, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 17, + 18, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 12, + 20, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 1, + 23, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-object.src.js.shot new file mode 100644 index 00000000000..5095e7ab7af --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/params-object.src.js.shot @@ -0,0 +1,474 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring params-object.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 13, + 14, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 16, + 17, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 11, + 19, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 22, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/destructuring/sparse-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/destructuring/sparse-array.src.js.shot new file mode 100644 index 00000000000..105e58db45b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/destructuring/sparse-array.src.js.shot @@ -0,0 +1,311 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript destructuring sparse-array.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + null, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 6, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 14, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "array", + "optional": false, + "range": Array [ + 9, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Identifier", + "value": "array", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/directives/block.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/directives/block.src.js.shot new file mode 100644 index 00000000000..845f8bffb2a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/directives/block.src.js.shot @@ -0,0 +1,514 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript directives block.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 19, + 31, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 19, + 32, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 39, + 44, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 35, + 45, + ], + "type": "VariableDeclaration", + }, + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 48, + 60, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 48, + 61, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 63, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 63, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 64, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 19, + 31, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 48, + 60, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/directives/directive-in-class.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/directives/directive-in-class.src.js.shot new file mode 100644 index 00000000000..bf1268df26e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/directives/directive-in-class.src.js.shot @@ -0,0 +1,1324 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript directives directive-in-class.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 31, + 42, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 31, + 75, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 56, + 68, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 56, + 69, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 46, + 75, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "params": Array [], + "range": Array [ + 43, + 75, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 85, + 88, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 5, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 81, + 121, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "range": Array [ + 102, + 114, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "range": Array [ + 102, + 115, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 10, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 92, + 121, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 10, + }, + "start": Object { + "column": 12, + "line": 8, + }, + }, + "params": Array [], + "range": Array [ + 89, + 121, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 12, + }, + "start": Object { + "column": 8, + "line": 12, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 131, + 134, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 5, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 12, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 127, + 172, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 13, + }, + "start": Object { + "column": 8, + "line": 13, + }, + }, + "range": Array [ + 153, + 165, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 13, + }, + "start": Object { + "column": 8, + "line": 13, + }, + }, + "range": Array [ + 153, + 166, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 14, + }, + "start": Object { + "column": 20, + "line": 12, + }, + }, + "range": Array [ + 143, + 172, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 14, + }, + "start": Object { + "column": 12, + "line": 12, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 12, + }, + "start": Object { + "column": 13, + "line": 12, + }, + }, + "name": "value", + "optional": false, + "range": Array [ + 136, + 141, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 135, + 172, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 16, + }, + "start": Object { + "column": 4, + "line": 16, + }, + }, + "name": "method", + "optional": false, + "range": Array [ + 178, + 184, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 18, + }, + "start": Object { + "column": 4, + "line": 16, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 178, + 217, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 17, + }, + "start": Object { + "column": 8, + "line": 17, + }, + }, + "range": Array [ + 198, + 210, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 17, + }, + "start": Object { + "column": 8, + "line": 17, + }, + }, + "range": Array [ + 198, + 211, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 18, + }, + "start": Object { + "column": 14, + "line": 16, + }, + }, + "range": Array [ + 188, + 217, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 18, + }, + "start": Object { + "column": 11, + "line": 16, + }, + }, + "params": Array [], + "range": Array [ + 185, + 217, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 19, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 25, + 219, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 19, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 15, + 219, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 20, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 220, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 31, + 42, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 56, + 68, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 81, + 84, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 85, + 88, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 8, + }, + "start": Object { + "column": 12, + "line": 8, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 13, + "line": 8, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "range": Array [ + 102, + 114, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 9, + }, + "start": Object { + "column": 20, + "line": 9, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 10, + }, + }, + "range": Array [ + 120, + 121, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 12, + }, + "start": Object { + "column": 4, + "line": 12, + }, + }, + "range": Array [ + 127, + 130, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 12, + }, + "start": Object { + "column": 8, + "line": 12, + }, + }, + "range": Array [ + 131, + 134, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 12, + }, + "start": Object { + "column": 12, + "line": 12, + }, + }, + "range": Array [ + 135, + 136, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 12, + }, + "start": Object { + "column": 13, + "line": 12, + }, + }, + "range": Array [ + 136, + 141, + ], + "type": "Identifier", + "value": "value", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 12, + }, + "start": Object { + "column": 18, + "line": 12, + }, + }, + "range": Array [ + 141, + 142, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 12, + }, + "start": Object { + "column": 20, + "line": 12, + }, + }, + "range": Array [ + 143, + 144, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 13, + }, + "start": Object { + "column": 8, + "line": 13, + }, + }, + "range": Array [ + 153, + 165, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 13, + }, + "start": Object { + "column": 20, + "line": 13, + }, + }, + "range": Array [ + 165, + 166, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "range": Array [ + 171, + 172, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 16, + }, + "start": Object { + "column": 4, + "line": 16, + }, + }, + "range": Array [ + 178, + 184, + ], + "type": "Identifier", + "value": "method", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 16, + }, + "start": Object { + "column": 11, + "line": 16, + }, + }, + "range": Array [ + 185, + 186, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 16, + }, + "start": Object { + "column": 12, + "line": 16, + }, + }, + "range": Array [ + 186, + 187, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 16, + }, + "start": Object { + "column": 14, + "line": 16, + }, + }, + "range": Array [ + 188, + 189, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 17, + }, + "start": Object { + "column": 8, + "line": 17, + }, + }, + "range": Array [ + 198, + 210, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 17, + }, + "start": Object { + "column": 20, + "line": 17, + }, + }, + "range": Array [ + 210, + 211, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 18, + }, + "start": Object { + "column": 4, + "line": 18, + }, + }, + "range": Array [ + 216, + 217, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 19, + }, + "start": Object { + "column": 0, + "line": 19, + }, + }, + "range": Array [ + 218, + 219, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/directives/first-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/directives/first-expression.src.js.shot new file mode 100644 index 00000000000..578bf631b6b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/directives/first-expression.src.js.shot @@ -0,0 +1,192 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript directives first-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 121, + 122, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 121, + 123, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 124, + 129, + ], + "raw": "\\"abc\\"", + "type": "Literal", + "value": "abc", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 124, + 129, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "type": "Line", + "value": " Prevent strings from being parsed as directives", + }, + Object { + "loc": Object { + "end": Object { + "column": 69, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 51, + 120, + ], + "type": "Line", + "value": " See https://github.com/prettier/prettier/pull/1560#issue-227225960", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 121, + 130, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 121, + 122, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 122, + 123, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 124, + 129, + ], + "type": "String", + "value": "\\"abc\\"", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/directives/function-non-strict.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/directives/function-non-strict.src.js.shot new file mode 100644 index 00000000000..f4f477bd5e5 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/directives/function-non-strict.src.js.shot @@ -0,0 +1,400 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript directives function-non-strict.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": "use smth", + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 20, + 30, + ], + "raw": "\\"use smth\\"", + "type": "Literal", + "value": "use smth", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 20, + 30, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 33, + 36, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 33, + 37, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 39, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 39, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 20, + 30, + ], + "type": "String", + "value": "\\"use smth\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/directives/non-directive-string.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/directives/non-directive-string.src.js.shot new file mode 100644 index 00000000000..7d58ddf9398 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/directives/non-directive-string.src.js.shot @@ -0,0 +1,978 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript directives non-directive-string.src 1`] = ` +Object { + "body": Array [ + Object { + "alternate": null, + "consequent": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 28, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 28, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 30, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 8, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + "type": "IfStatement", + }, + Object { + "cases": Array [ + Object { + "consequent": Array [ + Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 74, + 86, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 74, + 86, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 64, + 92, + ], + "type": "BlockStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 52, + 92, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 57, + 62, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + "type": "SwitchCase", + }, + Object { + "consequent": Array [ + Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "range": Array [ + 116, + 128, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "range": Array [ + 116, + 128, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 13, + "line": 9, + }, + }, + "range": Array [ + 106, + 134, + ], + "type": "BlockStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 97, + 134, + ], + "test": null, + "type": "SwitchCase", + }, + ], + "discriminant": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 40, + 44, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 32, + 136, + ], + "type": "SwitchStatement", + }, + Object { + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 15, + }, + "start": Object { + "column": 4, + "line": 15, + }, + }, + "range": Array [ + 157, + 169, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 15, + }, + "start": Object { + "column": 4, + "line": 15, + }, + }, + "range": Array [ + 157, + 169, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 16, + }, + "start": Object { + "column": 13, + "line": 14, + }, + }, + "range": Array [ + 151, + 171, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 16, + }, + "start": Object { + "column": 0, + "line": 14, + }, + }, + "range": Array [ + 138, + 171, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 14, + }, + "start": Object { + "column": 7, + "line": 14, + }, + }, + "range": Array [ + 145, + 149, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + "type": "WhileStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 17, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 172, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 2, + ], + "type": "Keyword", + "value": "if", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 8, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 28, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Keyword", + "value": "switch", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 40, + 44, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 52, + 56, + ], + "type": "Keyword", + "value": "case", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 57, + 62, + ], + "type": "Boolean", + "value": "false", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 74, + 86, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 91, + 92, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 97, + 104, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 11, + "line": 9, + }, + }, + "range": Array [ + 104, + 105, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 9, + }, + "start": Object { + "column": 13, + "line": 9, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "range": Array [ + 116, + 128, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "range": Array [ + 133, + 134, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 12, + }, + }, + "range": Array [ + 135, + 136, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 14, + }, + "start": Object { + "column": 0, + "line": 14, + }, + }, + "range": Array [ + 138, + 143, + ], + "type": "Keyword", + "value": "while", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 14, + }, + "start": Object { + "column": 6, + "line": 14, + }, + }, + "range": Array [ + 144, + 145, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 14, + }, + "start": Object { + "column": 7, + "line": 14, + }, + }, + "range": Array [ + 145, + 149, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 14, + }, + "start": Object { + "column": 11, + "line": 14, + }, + }, + "range": Array [ + 149, + 150, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 14, + }, + "start": Object { + "column": 13, + "line": 14, + }, + }, + "range": Array [ + 151, + 152, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 15, + }, + "start": Object { + "column": 4, + "line": 15, + }, + }, + "range": Array [ + 157, + 169, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 16, + }, + "start": Object { + "column": 0, + "line": 16, + }, + }, + "range": Array [ + 170, + 171, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/directives/program-order.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/directives/program-order.src.js.shot new file mode 100644 index 00000000000..f4f8b529b14 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/directives/program-order.src.js.shot @@ -0,0 +1,288 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript directives program-order.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": "use loose", + "expression": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "raw": "\\"use loose\\"", + "type": "Literal", + "value": "use loose", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 14, + 26, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "String", + "value": "\\"use loose\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/directives/program.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/directives/program.src.js.shot new file mode 100644 index 00000000000..24d4eb22e3c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/directives/program.src.js.shot @@ -0,0 +1,342 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript directives program.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 23, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 14, + 24, + ], + "type": "VariableDeclaration", + }, + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 25, + 37, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 25, + 38, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 25, + 37, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalAsyncIteration/async-generators.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalAsyncIteration/async-generators.src.js.shot new file mode 100644 index 00000000000..6b1ac11e719 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalAsyncIteration/async-generators.src.js.shot @@ -0,0 +1,234 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript experimentalAsyncIteration async-generators.src 1`] = ` +Object { + "body": Array [ + Object { + "async": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 26, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": true, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 26, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalAsyncIteration/async-iterator.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalAsyncIteration/async-iterator.src.js.shot new file mode 100644 index 00000000000..6d84f246347 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalAsyncIteration/async-iterator.src.js.shot @@ -0,0 +1,515 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript experimentalAsyncIteration async-iterator.src 1`] = ` +Object { + "body": Array [ + Object { + "async": true, + "body": Object { + "body": Array [ + Object { + "await": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 59, + 67, + ], + "type": "BlockStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "name": "item", + "optional": false, + "range": Array [ + 44, + 48, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 44, + 48, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 38, + 48, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 27, + 67, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "name": "items", + "optional": false, + "range": Array [ + 52, + 57, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "ForOfStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 69, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 69, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 70, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 31, + 36, + ], + "type": "Identifier", + "value": "await", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 38, + 43, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 44, + 48, + ], + "type": "Identifier", + "value": "item", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 49, + 51, + ], + "type": "Identifier", + "value": "of", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 52, + 57, + ], + "type": "Identifier", + "value": "items", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalDynamicImport/dynamic-import.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalDynamicImport/dynamic-import.src.js.shot new file mode 100644 index 00000000000..d1f1d8e7012 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalDynamicImport/dynamic-import.src.js.shot @@ -0,0 +1,344 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript experimentalDynamicImport dynamic-import.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "main", + "optional": false, + "range": Array [ + 19, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "object": Object { + "attributes": null, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "raw": "'foo'", + "type": "Literal", + "value": "foo", + }, + "type": "ImportExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "then", + "optional": false, + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 0, + 18, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 24, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "String", + "value": "'foo'", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + "value": "then", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "Identifier", + "value": "main", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/arg-spread.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/arg-spread.src.js.shot new file mode 100644 index 00000000000..819144e9ae4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/arg-spread.src.js.shot @@ -0,0 +1,435 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript experimentalObjectRestSpread arg-spread.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 12, + 13, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 15, + 19, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 11, + 20, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 24, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/destructuring-assign-mirror.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/destructuring-assign-mirror.src.js.shot new file mode 100644 index 00000000000..760d46c20a0 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/destructuring-assign-mirror.src.js.shot @@ -0,0 +1,582 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript experimentalObjectRestSpread destructuring-assign-mirror.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 2, + 3, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 5, + 9, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 1, + 10, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 1, + 22, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 14, + 15, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "SpreadElement", + }, + ], + "range": Array [ + 13, + 22, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ")", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/function-parameter-object-spread.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/function-parameter-object-spread.src.js.shot new file mode 100644 index 00000000000..88f212e3820 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/function-parameter-object-spread.src.js.shot @@ -0,0 +1,335 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript experimentalObjectRestSpread function-parameter-object-spread.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 14, + 20, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 13, + 21, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 26, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/invalid-rest-trailing-comma.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/invalid-rest-trailing-comma.src.js.shot new file mode 100644 index 00000000000..8c9bdda99a5 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/invalid-rest-trailing-comma.src.js.shot @@ -0,0 +1,513 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript experimentalObjectRestSpread invalid-rest-trailing-comma.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 6, + 7, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 9, + 10, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 12, + 16, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 4, + 19, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 25, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/object-rest.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/object-rest.src.js.shot new file mode 100644 index 00000000000..415f333aa84 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/object-rest.src.js.shot @@ -0,0 +1,1029 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript experimentalObjectRestSpread object-rest.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 6, + 7, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 9, + 10, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 12, + 16, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 4, + 18, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 23, + 27, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 29, + 33, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 35, + 39, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 41, + 42, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 41, + 45, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + }, + ], + "range": Array [ + 21, + 47, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 47, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/property-spread.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/property-spread.src.js.shot new file mode 100644 index 00000000000..776903479cd --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/property-spread.src.js.shot @@ -0,0 +1,903 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript experimentalObjectRestSpread property-spread.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "VariableDeclarator", + }, + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "get", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "VariableDeclarator", + }, + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "set", + "optional": false, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 42, + 50, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "name": "get", + "optional": false, + "range": Array [ + 56, + 59, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 56, + 64, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "name": "get", + "optional": false, + "range": Array [ + 61, + 64, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "name": "set", + "optional": false, + "range": Array [ + 73, + 76, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 77, + 80, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 73, + 80, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 70, + 80, + ], + "type": "SpreadElement", + }, + ], + "range": Array [ + 36, + 82, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 32, + 82, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 28, + 83, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 84, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 56, + 59, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "range": Array [ + 61, + 64, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 70, + 73, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 73, + 76, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 8, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "range": Array [ + 77, + 80, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 1, + "line": 9, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/shorthand-method-args.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/shorthand-method-args.src.js.shot new file mode 100644 index 00000000000..ca5b4583ef5 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/shorthand-method-args.src.js.shot @@ -0,0 +1,686 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript experimentalObjectRestSpread shorthand-method-args.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "initialize", + "optional": false, + "range": Array [ + 7, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": true, + "optional": false, + "range": Array [ + 7, + 104, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 48, + "line": 2, + }, + }, + "range": Array [ + 51, + 104, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 46, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "someVar", + "optional": false, + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 19, + 26, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "someVar", + "optional": false, + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "otherVar", + "optional": false, + "range": Array [ + 28, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 28, + 36, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "otherVar", + "optional": false, + "range": Array [ + 28, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "name": "options", + "optional": false, + "range": Array [ + 41, + 48, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 38, + 48, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 18, + 49, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 17, + 104, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "range": Array [ + 1, + 106, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 108, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 61, + 98, + ], + "type": "Line", + "value": " ... do some stuff with options ...", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 109, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 7, + 17, + ], + "type": "Identifier", + "value": "initialize", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + "value": "someVar", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 28, + 36, + ], + "type": "Identifier", + "value": "otherVar", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 38, + 41, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "range": Array [ + 41, + 48, + ], + "type": "Identifier", + "value": "options", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 2, + }, + "start": Object { + "column": 45, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 2, + }, + "start": Object { + "column": 46, + "line": 2, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 2, + }, + "start": Object { + "column": 48, + "line": 2, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/shorthand-methods.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/shorthand-methods.src.js.shot new file mode 100644 index 00000000000..13fa0d20e05 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/shorthand-methods.src.js.shot @@ -0,0 +1,746 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript experimentalObjectRestSpread shorthand-methods.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "initialize", + "optional": false, + "range": Array [ + 14, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": true, + "optional": false, + "range": Array [ + 14, + 111, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 48, + "line": 2, + }, + }, + "range": Array [ + 58, + 111, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 46, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "someVar", + "optional": false, + "range": Array [ + 26, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 26, + 33, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "someVar", + "optional": false, + "range": Array [ + 26, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "otherVar", + "optional": false, + "range": Array [ + 35, + 43, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 35, + 43, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "otherVar", + "optional": false, + "range": Array [ + 35, + 43, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "name": "options", + "optional": false, + "range": Array [ + 48, + 55, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 45, + 55, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 25, + 56, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 24, + 111, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "range": Array [ + 8, + 113, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 113, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 114, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 68, + 105, + ], + "type": "Line", + "value": " ... do some stuff with options ...", + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 114, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 24, + ], + "type": "Identifier", + "value": "initialize", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 33, + ], + "type": "Identifier", + "value": "someVar", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 35, + 43, + ], + "type": "Identifier", + "value": "otherVar", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 45, + 48, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "range": Array [ + 48, + 55, + ], + "type": "Identifier", + "value": "options", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 2, + }, + "start": Object { + "column": 45, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 2, + }, + "start": Object { + "column": 46, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 2, + }, + "start": Object { + "column": 48, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/shorthand-properties.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/shorthand-properties.src.js.shot new file mode 100644 index 00000000000..750f593f3f5 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/shorthand-properties.src.js.shot @@ -0,0 +1,755 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript experimentalObjectRestSpread shorthand-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "VariableDeclarator", + }, + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "get", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "VariableDeclarator", + }, + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "set", + "optional": false, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 42, + 45, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "name": "get", + "optional": false, + "range": Array [ + 51, + 54, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 51, + 54, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "name": "get", + "optional": false, + "range": Array [ + 51, + 54, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "name": "set", + "optional": false, + "range": Array [ + 63, + 66, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 60, + 66, + ], + "type": "SpreadElement", + }, + ], + "range": Array [ + 36, + 68, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 32, + 68, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 28, + 69, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 70, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 51, + 54, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 60, + 63, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 63, + 66, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 1, + "line": 9, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/single-spread.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/single-spread.src.js.shot new file mode 100644 index 00000000000..8d485633566 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/single-spread.src.js.shot @@ -0,0 +1,827 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript experimentalObjectRestSpread single-spread.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "VariableDeclarator", + }, + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "get", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "VariableDeclarator", + }, + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "set", + "optional": false, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 42, + 50, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "name": "get", + "optional": false, + "range": Array [ + 56, + 59, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 56, + 64, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "name": "get", + "optional": false, + "range": Array [ + 61, + 64, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "name": "set", + "optional": false, + "range": Array [ + 73, + 76, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 70, + 76, + ], + "type": "SpreadElement", + }, + ], + "range": Array [ + 36, + 78, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 32, + 78, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 28, + 79, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 80, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 56, + 59, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "range": Array [ + 61, + 64, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 70, + 73, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 73, + 76, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 1, + "line": 9, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/spread-trailing-comma.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/spread-trailing-comma.src.js.shot new file mode 100644 index 00000000000..1db33326199 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/spread-trailing-comma.src.js.shot @@ -0,0 +1,428 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript experimentalObjectRestSpread spread-trailing-comma.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 3, + 4, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 6, + 7, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "type": "SpreadElement", + }, + ], + "range": Array [ + 1, + 16, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/two-spread.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/two-spread.src.js.shot new file mode 100644 index 00000000000..e5a7e057f22 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/experimentalObjectRestSpread/two-spread.src.js.shot @@ -0,0 +1,783 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript experimentalObjectRestSpread two-spread.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "VariableDeclarator", + }, + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "get", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "VariableDeclarator", + }, + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "set", + "optional": false, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 42, + 50, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "name": "get", + "optional": false, + "range": Array [ + 59, + 62, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 56, + 62, + ], + "type": "SpreadElement", + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "name": "set", + "optional": false, + "range": Array [ + 71, + 74, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "SpreadElement", + }, + ], + "range": Array [ + 36, + 76, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 32, + 76, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 28, + 77, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 78, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 56, + 59, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 59, + 62, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 68, + 71, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 71, + 74, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 1, + "line": 9, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/exponentiationOperators/exponential-operators.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/exponentiationOperators/exponential-operators.src.js.shot new file mode 100644 index 00000000000..96a8280ac8c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/exponentiationOperators/exponential-operators.src.js.shot @@ -0,0 +1,417 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript exponentiationOperators exponential-operators.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "operator": "**", + "range": Array [ + 8, + 14, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "operator": "**=", + "range": Array [ + 16, + 23, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 16, + 24, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "Punctuator", + "value": "**", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Punctuator", + "value": "**=", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/for/for-loop.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/for/for-loop.src.js.shot new file mode 100644 index 00000000000..6176a65ea4a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/for/for-loop.src.js.shot @@ -0,0 +1,527 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript for for-loop.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 30, + ], + "type": "BlockStatement", + }, + "init": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "i", + "optional": false, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 13, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 13, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "test": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "i", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "operator": "<", + "range": Array [ + 15, + 21, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "type": "BinaryExpression", + }, + "type": "ForStatement", + "update": Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "i", + "optional": false, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "operator": "++", + "prefix": false, + "range": Array [ + 23, + 26, + ], + "type": "UpdateExpression", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "Punctuator", + "value": "++", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/for/for-with-coma.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/for/for-with-coma.src.js.shot new file mode 100644 index 00000000000..5e628265a04 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/for/for-with-coma.src.js.shot @@ -0,0 +1,772 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript for for-with-coma.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 41, + 44, + ], + "type": "BlockStatement", + }, + "init": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "i", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "VariableDeclarator", + }, + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "j", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 22, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "test": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "i", + "optional": false, + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "operator": "<", + "range": Array [ + 24, + 29, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "j", + "optional": false, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "BinaryExpression", + }, + "type": "ForStatement", + "update": Object { + "expressions": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "name": "i", + "optional": false, + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "operator": "++", + "prefix": false, + "range": Array [ + 31, + 34, + ], + "type": "UpdateExpression", + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "name": "j", + "optional": false, + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "operator": "--", + "prefix": false, + "range": Array [ + 36, + 39, + ], + "type": "UpdateExpression", + }, + ], + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 39, + ], + "type": "SequenceExpression", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 46, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "j", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "value": "j", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 34, + ], + "type": "Punctuator", + "value": "++", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + "value": "j", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 39, + ], + "type": "Punctuator", + "value": "--", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/for/for-with-const.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/for/for-with-const.src.js.shot new file mode 100644 index 00000000000..a401f8c5240 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/for/for-with-const.src.js.shot @@ -0,0 +1,454 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript for for-with-const.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "BlockStatement", + }, + "init": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "i", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 16, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "test": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "i", + "optional": false, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "operator": "<", + "range": Array [ + 18, + 23, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "j", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "BinaryExpression", + }, + "type": "ForStatement", + "update": null, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "j", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/for/for-with-function.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/for/for-with-function.src.js.shot new file mode 100644 index 00000000000..8048d407b66 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/for/for-with-function.src.js.shot @@ -0,0 +1,639 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript for for-with-function.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "EmptyStatement", + }, + "init": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 5, + 10, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "test": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 12, + 33, + ], + "right": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "toExponential", + "optional": false, + "range": Array [ + 18, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 16, + 31, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 16, + 33, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "type": "AssignmentExpression", + }, + "type": "ForStatement", + "update": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 35, + 40, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "type": "AssignmentExpression", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 31, + ], + "type": "Identifier", + "value": "toExponential", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/for/for-with-let.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/for/for-with-let.src.js.shot new file mode 100644 index 00000000000..ab5c97cf978 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/for/for-with-let.src.js.shot @@ -0,0 +1,454 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript for for-with-let.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "BlockStatement", + }, + "init": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "i", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 16, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "test": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "i", + "optional": false, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "operator": "<", + "range": Array [ + 18, + 23, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "j", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "BinaryExpression", + }, + "type": "ForStatement", + "update": null, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "j", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-array.src.js.shot new file mode 100644 index 00000000000..3a127f9866d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-array.src.js.shot @@ -0,0 +1,263 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript forIn for-in-array.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "BlockStatement", + }, + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "i", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "right": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "ArrayExpression", + }, + "type": "ForInStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-bare-nonstrict.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-bare-nonstrict.src.js.shot new file mode 100644 index 00000000000..10b3380c144 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-bare-nonstrict.src.js.shot @@ -0,0 +1,1663 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript forIn for-in-bare-nonstrict.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "effects", + "optional": false, + "range": Array [ + 4, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 15, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "iterations", + "optional": false, + "range": Array [ + 21, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 35, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 17, + 36, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "stored", + "optional": false, + "range": Array [ + 41, + 47, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 41, + 47, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 37, + 48, + ], + "type": "VariableDeclaration", + }, + Object { + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": "iterations", + "optional": false, + "range": Array [ + 119, + 129, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "operator": "++", + "prefix": true, + "range": Array [ + 117, + 129, + ], + "type": "UpdateExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 117, + 130, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 64, + "line": 4, + }, + }, + "range": Array [ + 113, + 132, + ], + "type": "BlockStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 58, + 59, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "expressions": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "name": "effects", + "optional": false, + "range": Array [ + 65, + 72, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "operator": "++", + "prefix": true, + "range": Array [ + 63, + 72, + ], + "type": "UpdateExpression", + }, + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "range": Array [ + 75, + 76, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "operator": "-", + "prefix": true, + "range": Array [ + 74, + 76, + ], + "type": "UnaryExpression", + }, + ], + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 63, + 76, + ], + "type": "SequenceExpression", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 58, + 77, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 54, + 77, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 49, + 132, + ], + "right": Object { + "expressions": Array [ + Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 32, + "line": 4, + }, + }, + "name": "stored", + "optional": false, + "range": Array [ + 81, + 87, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 32, + "line": 4, + }, + }, + "operator": "=", + "range": Array [ + 81, + 91, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 41, + "line": 4, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 90, + 91, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + Object { + "loc": Object { + "end": Object { + "column": 62, + "line": 4, + }, + "start": Object { + "column": 44, + "line": 4, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 46, + "line": 4, + }, + "start": Object { + "column": 45, + "line": 4, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 94, + 95, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 49, + "line": 4, + }, + "start": Object { + "column": 45, + "line": 4, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 94, + 98, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 4, + }, + "start": Object { + "column": 48, + "line": 4, + }, + }, + "range": Array [ + 97, + 98, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 52, + "line": 4, + }, + "start": Object { + "column": 51, + "line": 4, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 100, + 101, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 55, + "line": 4, + }, + "start": Object { + "column": 51, + "line": 4, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 100, + 104, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 4, + }, + "start": Object { + "column": 54, + "line": 4, + }, + }, + "range": Array [ + 103, + 104, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 58, + "line": 4, + }, + "start": Object { + "column": 57, + "line": 4, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 106, + 107, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 61, + "line": 4, + }, + "start": Object { + "column": 57, + "line": 4, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 106, + 110, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 4, + }, + "start": Object { + "column": 60, + "line": 4, + }, + }, + "range": Array [ + 109, + 110, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + }, + ], + "range": Array [ + 93, + 111, + ], + "type": "ObjectExpression", + }, + ], + "loc": Object { + "end": Object { + "column": 62, + "line": 4, + }, + "start": Object { + "column": 32, + "line": 4, + }, + }, + "range": Array [ + 81, + 111, + ], + "type": "SequenceExpression", + }, + "type": "ForInStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 133, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 11, + ], + "type": "Identifier", + "value": "effects", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 31, + ], + "type": "Identifier", + "value": "iterations", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 37, + 40, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 41, + 47, + ], + "type": "Identifier", + "value": "stored", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 49, + 52, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 54, + 57, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 63, + 65, + ], + "type": "Punctuator", + "value": "++", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 65, + 72, + ], + "type": "Identifier", + "value": "effects", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": "-", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 29, + "line": 4, + }, + }, + "range": Array [ + 78, + 80, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 32, + "line": 4, + }, + }, + "range": Array [ + 81, + 87, + ], + "type": "Identifier", + "value": "stored", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 39, + "line": 4, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 41, + "line": 4, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 4, + }, + "start": Object { + "column": 42, + "line": 4, + }, + }, + "range": Array [ + 91, + 92, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 4, + }, + "start": Object { + "column": 44, + "line": 4, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 4, + }, + "start": Object { + "column": 45, + "line": 4, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 4, + }, + "start": Object { + "column": 46, + "line": 4, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 4, + }, + "start": Object { + "column": 48, + "line": 4, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 4, + }, + "start": Object { + "column": 49, + "line": 4, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 4, + }, + "start": Object { + "column": 51, + "line": 4, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 4, + }, + "start": Object { + "column": 52, + "line": 4, + }, + }, + "range": Array [ + 101, + 102, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 4, + }, + "start": Object { + "column": 54, + "line": 4, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 4, + }, + "start": Object { + "column": 55, + "line": 4, + }, + }, + "range": Array [ + 104, + 105, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 4, + }, + "start": Object { + "column": 57, + "line": 4, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 4, + }, + "start": Object { + "column": 58, + "line": 4, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 4, + }, + "start": Object { + "column": 60, + "line": 4, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 62, + "line": 4, + }, + "start": Object { + "column": 61, + "line": 4, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 63, + "line": 4, + }, + "start": Object { + "column": 62, + "line": 4, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 4, + }, + "start": Object { + "column": 64, + "line": 4, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 117, + 119, + ], + "type": "Punctuator", + "value": "++", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 119, + 129, + ], + "type": "Identifier", + "value": "iterations", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 129, + 130, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-destruction-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-destruction-object.src.js.shot new file mode 100644 index 00000000000..ec228929e7f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-destruction-object.src.js.shot @@ -0,0 +1,507 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript forIn for-in-destruction-object.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 33, + ], + "type": "BlockStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "name", + "optional": false, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 10, + 14, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "name", + "optional": false, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "value", + "optional": false, + "range": Array [ + 16, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 16, + 21, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "value", + "optional": false, + "range": Array [ + 16, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 9, + 22, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 22, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 22, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "obj", + "optional": false, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "ForInStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Identifier", + "value": "value", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "obj", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-destruction.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-destruction.src.js.shot new file mode 100644 index 00000000000..5ca5941cc03 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-destruction.src.js.shot @@ -0,0 +1,421 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript forIn for-in-destruction.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 33, + ], + "type": "BlockStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "name", + "optional": false, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "value", + "optional": false, + "range": Array [ + 16, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 9, + 22, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 22, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 22, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "obj", + "optional": false, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "ForInStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Identifier", + "value": "value", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "obj", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-object-with-body.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-object-with-body.src.js.shot new file mode 100644 index 00000000000..e274135285c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-object-with-body.src.js.shot @@ -0,0 +1,263 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript forIn for-in-object-with-body.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "BlockStatement", + }, + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "i", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 10, + 12, + ], + "type": "ObjectExpression", + }, + "type": "ForInStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-assigment.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-assigment.src.js.shot new file mode 100644 index 00000000000..2c96724ca6f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-assigment.src.js.shot @@ -0,0 +1,477 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript forIn for-in-with-assigment.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "process", + "optional": false, + "range": Array [ + 25, + 32, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 25, + 35, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 36, + ], + "type": "ExpressionStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 15, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "list", + "optional": false, + "range": Array [ + 19, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "ForInStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "Identifier", + "value": "list", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 32, + ], + "type": "Identifier", + "value": "process", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-bare-assigment.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-bare-assigment.src.js.shot new file mode 100644 index 00000000000..58e34531661 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-bare-assigment.src.js.shot @@ -0,0 +1,304 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript forIn for-in-with-bare-assigment.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "EmptyStatement", + }, + "left": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 5, + 10, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "arr", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "ForInStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 13, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "arr", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-const.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-const.src.js.shot new file mode 100644 index 00000000000..9ee132c790e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-const.src.js.shot @@ -0,0 +1,423 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript forIn for-in-with-const.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "process", + "optional": false, + "range": Array [ + 22, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 22, + 32, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 33, + ], + "type": "ExpressionStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 12, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "list", + "optional": false, + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "ForInStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + "value": "list", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 29, + ], + "type": "Identifier", + "value": "process", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-milti-asigment.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-milti-asigment.src.js.shot new file mode 100644 index 00000000000..d9f49369727 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-milti-asigment.src.js.shot @@ -0,0 +1,418 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript forIn for-in-with-milti-asigment.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "EmptyStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 13, + 18, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 18, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 18, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "q", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "ForInStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 21, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "q", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-rest.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-rest.src.js.shot new file mode 100644 index 00000000000..19bad50a51c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-rest.src.js.shot @@ -0,0 +1,481 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript forIn for-in-with-rest.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 41, + ], + "type": "BlockStatement", + }, + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 7, + 12, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "xx", + "optional": false, + "range": Array [ + 10, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "rrestOff", + "optional": false, + "range": Array [ + 17, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 14, + 25, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 5, + 27, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "name": "array", + "optional": false, + "range": Array [ + 31, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "ForInStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "Identifier", + "value": "xx", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 25, + ], + "type": "Identifier", + "value": "rrestOff", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 30, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 36, + ], + "type": "Identifier", + "value": "array", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-var.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-var.src.js.shot new file mode 100644 index 00000000000..cd027ffe1b5 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/forIn/for-in-with-var.src.js.shot @@ -0,0 +1,423 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript forIn for-in-with-var.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "process", + "optional": false, + "range": Array [ + 20, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 20, + 30, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 31, + ], + "type": "ExpressionStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "list", + "optional": false, + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "ForInStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 13, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + "value": "list", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 27, + ], + "type": "Identifier", + "value": "process", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-array.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-array.src.js.shot new file mode 100644 index 00000000000..74c75ca0a0d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-array.src.js.shot @@ -0,0 +1,399 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript forOf for-of-array.src 1`] = ` +Object { + "body": Array [ + Object { + "await": false, + "body": Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "doSomething", + "optional": false, + "range": Array [ + 22, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 22, + 35, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 36, + ], + "type": "ExpressionStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "right": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "ArrayExpression", + }, + "type": "ForOfStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 13, + ], + "type": "Identifier", + "value": "of", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 33, + ], + "type": "Identifier", + "value": "doSomething", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-destruction-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-destruction-object.src.js.shot new file mode 100644 index 00000000000..99ac29fb8ad --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-destruction-object.src.js.shot @@ -0,0 +1,508 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript forOf for-of-destruction-object.src 1`] = ` +Object { + "body": Array [ + Object { + "await": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 33, + ], + "type": "BlockStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "name", + "optional": false, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 10, + 14, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "name", + "optional": false, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "value", + "optional": false, + "range": Array [ + 16, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 16, + 21, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "value", + "optional": false, + "range": Array [ + 16, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 9, + 22, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 22, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 22, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "obj", + "optional": false, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "ForOfStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Identifier", + "value": "value", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "Identifier", + "value": "of", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "obj", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-destruction.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-destruction.src.js.shot new file mode 100644 index 00000000000..2b4a1754bd5 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-destruction.src.js.shot @@ -0,0 +1,422 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript forOf for-of-destruction.src 1`] = ` +Object { + "body": Array [ + Object { + "await": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 33, + ], + "type": "BlockStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "name", + "optional": false, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "value", + "optional": false, + "range": Array [ + 16, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 9, + 22, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 22, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 22, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "obj", + "optional": false, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "ForOfStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Identifier", + "value": "value", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "Identifier", + "value": "of", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "obj", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-object.src.js.shot new file mode 100644 index 00000000000..a5f1c5aeb05 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-object.src.js.shot @@ -0,0 +1,399 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript forOf for-of-object.src 1`] = ` +Object { + "body": Array [ + Object { + "await": false, + "body": Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "doSomething", + "optional": false, + "range": Array [ + 22, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 22, + 35, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 36, + ], + "type": "ExpressionStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 14, + 16, + ], + "type": "ObjectExpression", + }, + "type": "ForOfStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 13, + ], + "type": "Identifier", + "value": "of", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 33, + ], + "type": "Identifier", + "value": "doSomething", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-function-initializer.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-function-initializer.src.js.shot new file mode 100644 index 00000000000..cbaf9bb3a10 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-function-initializer.src.js.shot @@ -0,0 +1,737 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript forOf for-of-with-function-initializer.src 1`] = ` +Object { + "body": Array [ + Object { + "await": false, + "body": Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 62, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 61, + 62, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 60, + "line": 1, + }, + "start": Object { + "column": 53, + "line": 1, + }, + }, + "name": "process", + "optional": false, + "range": Array [ + 53, + 60, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 63, + "line": 1, + }, + "start": Object { + "column": 53, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 53, + 63, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 53, + "line": 1, + }, + }, + "range": Array [ + 53, + 64, + ], + "type": "ExpressionStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "i", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 35, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "operator": "in", + "range": Array [ + 33, + 41, + ], + "right": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 41, + ], + "type": "ArrayExpression", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 41, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 43, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 13, + 43, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 43, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 43, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 64, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 51, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "name": "list", + "optional": false, + "range": Array [ + 47, + 51, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "ForOfStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 21, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 35, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 38, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 46, + ], + "type": "Identifier", + "value": "of", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 51, + ], + "type": "Identifier", + "value": "list", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 60, + "line": 1, + }, + "start": Object { + "column": 53, + "line": 1, + }, + }, + "range": Array [ + 53, + 60, + ], + "type": "Identifier", + "value": "process", + }, + Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 1, + }, + "start": Object { + "column": 60, + "line": 1, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 62, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 63, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 63, + "line": 1, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-rest.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-rest.src.js.shot new file mode 100644 index 00000000000..519f3a57053 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-rest.src.js.shot @@ -0,0 +1,482 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript forOf for-of-with-rest.src 1`] = ` +Object { + "body": Array [ + Object { + "await": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 41, + ], + "type": "BlockStatement", + }, + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 7, + 12, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "xx", + "optional": false, + "range": Array [ + 10, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "rrestOff", + "optional": false, + "range": Array [ + 17, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 14, + 25, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 5, + 27, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "name": "array", + "optional": false, + "range": Array [ + 31, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "ForOfStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 12, + ], + "type": "Identifier", + "value": "xx", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 25, + ], + "type": "Identifier", + "value": "rrestOff", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 30, + ], + "type": "Identifier", + "value": "of", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 36, + ], + "type": "Identifier", + "value": "array", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-var-and-braces.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-var-and-braces.src.js.shot new file mode 100644 index 00000000000..07b52f769da --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-var-and-braces.src.js.shot @@ -0,0 +1,439 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript forOf for-of-with-var-and-braces.src 1`] = ` +Object { + "body": Array [ + Object { + "await": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "doSomething", + "optional": false, + "range": Array [ + 25, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 25, + 38, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 39, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 41, + ], + "type": "BlockStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "ForOfStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 13, + ], + "type": "Identifier", + "value": "of", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 36, + ], + "type": "Identifier", + "value": "doSomething", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-var-and-no-braces.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-var-and-no-braces.src.js.shot new file mode 100644 index 00000000000..6f07f5aae40 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/forOf/for-of-with-var-and-no-braces.src.js.shot @@ -0,0 +1,384 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript forOf for-of-with-var-and-no-braces.src 1`] = ` +Object { + "body": Array [ + Object { + "await": false, + "body": Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "doSomething", + "optional": false, + "range": Array [ + 23, + 34, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 23, + 36, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 23, + 37, + ], + "type": "ExpressionStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "ForOfStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 13, + ], + "type": "Identifier", + "value": "of", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 23, + 34, + ], + "type": "Identifier", + "value": "doSomething", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forOf/invalid-for-of-with-const-and-no-braces.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forOf/invalid-for-of-with-const-and-no-braces.src.js.shot new file mode 100644 index 00000000000..a7da09419e4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/forOf/invalid-for-of-with-const-and-no-braces.src.js.shot @@ -0,0 +1,384 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript forOf invalid-for-of-with-const-and-no-braces.src 1`] = ` +Object { + "body": Array [ + Object { + "await": false, + "body": Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "doSomething", + "optional": false, + "range": Array [ + 25, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 25, + 38, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 39, + ], + "type": "ExpressionStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 12, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "ForOfStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "Identifier", + "value": "of", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 36, + ], + "type": "Identifier", + "value": "doSomething", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/forOf/invalid-for-of-with-let-and-no-braces.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/forOf/invalid-for-of-with-let-and-no-braces.src.js.shot new file mode 100644 index 00000000000..82a3ee19470 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/forOf/invalid-for-of-with-let-and-no-braces.src.js.shot @@ -0,0 +1,384 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript forOf invalid-for-of-with-let-and-no-braces.src 1`] = ` +Object { + "body": Array [ + Object { + "await": false, + "body": Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "doSomething", + "optional": false, + "range": Array [ + 23, + 34, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 23, + 36, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 23, + 37, + ], + "type": "ExpressionStatement", + }, + "left": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "VariableDeclaration", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "ForOfStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "for", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 13, + ], + "type": "Identifier", + "value": "of", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 23, + 34, + ], + "type": "Identifier", + "value": "doSomething", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/function/return-multiline-sequence.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/function/return-multiline-sequence.src.js.shot new file mode 100644 index 00000000000..b4d0437e1ec --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/function/return-multiline-sequence.src.js.shot @@ -0,0 +1,614 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript function return-multiline-sequence.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "expressions": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 54, + 55, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 40, + 55, + ], + "type": "SequenceExpression", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 27, + 60, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 62, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 62, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 63, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/function/return-sequence.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/function/return-sequence.src.js.shot new file mode 100644 index 00000000000..c21961a3880 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/function/return-sequence.src.js.shot @@ -0,0 +1,614 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript function return-sequence.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "expressions": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 41, + 42, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 35, + 42, + ], + "type": "SequenceExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 27, + 44, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 46, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 46, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/generators/anonymous-generator.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/generators/anonymous-generator.src.js.shot new file mode 100644 index 00000000000..d4e84ee7c6e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/generators/anonymous-generator.src.js.shot @@ -0,0 +1,344 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript generators anonymous-generator.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "v", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "delegate": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 25, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "v", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/generators/async-generator-function.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/generators/async-generator-function.src.js.shot new file mode 100644 index 00000000000..b6be040201e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/generators/async-generator-function.src.js.shot @@ -0,0 +1,234 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript generators async-generator-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 23, + 27, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": true, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 1, + 27, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 1, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 1, + 6, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/generators/async-generator-method.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/generators/async-generator-method.src.js.shot new file mode 100644 index 00000000000..3ed979807f5 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/generators/async-generator-method.src.js.shot @@ -0,0 +1,660 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript generators async-generator-method.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 63, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": true, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "argument": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "name": "g", + "optional": false, + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "optional": false, + "range": Array [ + 53, + 56, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "delegate": true, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 46, + 56, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 42, + 56, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 36, + 57, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 63, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 23, + 63, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 65, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 66, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 36, + 41, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 46, + 51, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + "value": "g", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/generators/double-yield.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/generators/double-yield.src.js.shot new file mode 100644 index 00000000000..70f7e605cf6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/generators/double-yield.src.js.shot @@ -0,0 +1,378 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript generators double-yield.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "argument": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 30, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "delegate": false, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 30, + ], + "type": "YieldExpression", + }, + "delegate": false, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 30, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 30, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 32, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 32, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 27, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 30, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/generators/empty-generator-declaration.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/generators/empty-generator-declaration.src.js.shot new file mode 100644 index 00000000000..17e49d51c0a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/generators/empty-generator-declaration.src.js.shot @@ -0,0 +1,251 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript generators empty-generator-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": true, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "t", + "optional": false, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 16, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "t", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/generators/generator-declaration.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/generators/generator-declaration.src.js.shot new file mode 100644 index 00000000000..736526fa8d4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/generators/generator-declaration.src.js.shot @@ -0,0 +1,363 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript generators generator-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": "v", + "optional": false, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "delegate": true, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 28, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 28, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 30, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": true, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "test", + "optional": false, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 30, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 25, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "value": "v", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/generators/yield-delegation.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/generators/yield-delegation.src.js.shot new file mode 100644 index 00000000000..158c5c87e33 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/generators/yield-delegation.src.js.shot @@ -0,0 +1,362 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript generators yield-delegation.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "v", + "optional": false, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "delegate": true, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 24, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 24, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 26, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 26, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "v", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/generators/yield-without-value-in-call.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/generators/yield-without-value-in-call.src.js.shot new file mode 100644 index 00000000000..c0675208885 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/generators/yield-without-value-in-call.src.js.shot @@ -0,0 +1,420 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript generators yield-without-value-in-call.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "argument": null, + "delegate": false, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "YieldExpression", + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "fn", + "optional": false, + "range": Array [ + 16, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 16, + 25, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 26, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 28, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 28, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/generators/yield-without-value-no-semi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/generators/yield-without-value-no-semi.src.js.shot new file mode 100644 index 00000000000..ee157115e5c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/generators/yield-without-value-no-semi.src.js.shot @@ -0,0 +1,306 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript generators yield-without-value-no-semi.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "argument": null, + "delegate": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 23, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 23, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/generators/yield-without-value.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/generators/yield-without-value.src.js.shot new file mode 100644 index 00000000000..4e7e917ea77 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/generators/yield-without-value.src.js.shot @@ -0,0 +1,324 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript generators yield-without-value.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "argument": null, + "delegate": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 24, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 24, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/globalReturn/return-identifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/globalReturn/return-identifier.src.js.shot new file mode 100644 index 00000000000..9fd7c11f50b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/globalReturn/return-identifier.src.js.shot @@ -0,0 +1,119 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript globalReturn return-identifier.src 1`] = ` +Object { + "body": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "fooz", + "optional": false, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ReturnStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "value": "fooz", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/hexLiterals/lowercase.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/hexLiterals/lowercase.src.js.shot new file mode 100644 index 00000000000..e91d302d0bc --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/hexLiterals/lowercase.src.js.shot @@ -0,0 +1,100 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript hexLiterals lowercase.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "raw": "0x2343", + "type": "Literal", + "value": 9027, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Numeric", + "value": "0x2343", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/hexLiterals/uppercase.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/hexLiterals/uppercase.src.js.shot new file mode 100644 index 00000000000..360ccd1bfb4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/hexLiterals/uppercase.src.js.shot @@ -0,0 +1,100 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript hexLiterals uppercase.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "raw": "0X2343", + "type": "Literal", + "value": 9027, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Numeric", + "value": "0X2343", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/importMeta/simple-import-meta.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/importMeta/simple-import-meta.src.js.shot new file mode 100644 index 00000000000..528b9d9652c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/importMeta/simple-import-meta.src.js.shot @@ -0,0 +1,252 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript importMeta simple-import-meta.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "meta": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "import", + "optional": false, + "range": Array [ + 0, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "meta", + "optional": false, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 0, + 11, + ], + "type": "MetaProperty", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "url", + "optional": false, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 0, + 15, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "value": "meta", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "url", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/labels/label-break.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/labels/label-break.src.js.shot new file mode 100644 index 00000000000..e341b8a49f3 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/labels/label-break.src.js.shot @@ -0,0 +1,410 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript labels label-break.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Object { + "body": Array [ + Object { + "label": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "name": "loop1", + "optional": false, + "range": Array [ + 33, + 38, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 27, + 39, + ], + "type": "BreakStatement", + }, + Object { + "label": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 44, + 50, + ], + "type": "BreakStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 21, + 54, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 9, + 54, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 15, + 19, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + "type": "WhileStatement", + }, + "label": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "loop1", + "optional": false, + "range": Array [ + 0, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 54, + ], + "type": "LabeledStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 55, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Identifier", + "value": "loop1", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Keyword", + "value": "while", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 15, + 19, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 27, + 32, + ], + "type": "Keyword", + "value": "break", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 33, + 38, + ], + "type": "Identifier", + "value": "loop1", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 44, + 49, + ], + "type": "Keyword", + "value": "break", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/labels/label-continue.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/labels/label-continue.src.js.shot new file mode 100644 index 00000000000..94452ddccd2 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/labels/label-continue.src.js.shot @@ -0,0 +1,410 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript labels label-continue.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Object { + "body": Array [ + Object { + "label": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "loop1", + "optional": false, + "range": Array [ + 36, + 41, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 27, + 42, + ], + "type": "ContinueStatement", + }, + Object { + "label": null, + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 47, + 56, + ], + "type": "ContinueStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 21, + 60, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 9, + 60, + ], + "test": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 15, + 19, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + "type": "WhileStatement", + }, + "label": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "loop1", + "optional": false, + "range": Array [ + 0, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 60, + ], + "type": "LabeledStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 61, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Identifier", + "value": "loop1", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Keyword", + "value": "while", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 15, + 19, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 27, + 35, + ], + "type": "Keyword", + "value": "continue", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 36, + 41, + ], + "type": "Identifier", + "value": "loop1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 47, + 55, + ], + "type": "Keyword", + "value": "continue", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/error-delete.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/error-delete.src.js.shot new file mode 100644 index 00000000000..05f6591d9f2 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/error-delete.src.js.shot @@ -0,0 +1,307 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules error-delete.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "value", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "raw": "\\"x\\"", + "type": "Literal", + "value": "x", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 7, + 8, + ], + "type": "ImportDefaultSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + Object { + "directive": undefined, + "expression": Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "operator": "delete", + "prefix": true, + "range": Array [ + 19, + 27, + ], + "type": "UnaryExpression", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 19, + 28, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "String", + "value": "\\"x\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "Keyword", + "value": "delete", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/error-function.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/error-function.src.js.shot new file mode 100644 index 00000000000..b679d5c3db1 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/error-function.src.js.shot @@ -0,0 +1,310 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules error-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "declaration": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "friends", + "optional": false, + "range": Array [ + 31, + 38, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 16, + 39, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 41, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 41, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 23, + 30, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "Identifier", + "value": "friends", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/error-strict.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/error-strict.src.js.shot new file mode 100644 index 00000000000..7d16a340d5a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/error-strict.src.js.shot @@ -0,0 +1,607 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules error-strict.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "value", + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 25, + ], + "raw": "\\"house\\"", + "type": "Literal", + "value": "house", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "house", + "optional": false, + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 7, + 12, + ], + "type": "ImportDefaultSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + Object { + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "name": "roof", + "optional": false, + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "name": "console", + "optional": false, + "range": Array [ + 44, + 51, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "name": "log", + "optional": false, + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 44, + 55, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 44, + 61, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 44, + 62, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 41, + 64, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "house", + "optional": false, + "range": Array [ + 34, + 39, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 28, + 64, + ], + "type": "WithStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + "value": "house", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 25, + ], + "type": "String", + "value": "\\"house\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 28, + 32, + ], + "type": "Keyword", + "value": "with", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 34, + 39, + ], + "type": "Identifier", + "value": "house", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 44, + 51, + ], + "type": "Identifier", + "value": "console", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + "value": "log", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 56, + 60, + ], + "type": "Identifier", + "value": "roof", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-async-named-function.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-async-named-function.src.js.shot new file mode 100644 index 00000000000..a8e1ef5fe2f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-async-named-function.src.js.shot @@ -0,0 +1,255 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-async-named-function.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "async": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 30, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 7, + 30, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 21, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-const.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-const.src.js.shot new file mode 100644 index 00000000000..0a95bfa68eb --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-const.src.js.shot @@ -0,0 +1,235 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-const.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 20, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 21, + ], + "type": "VariableDeclaration", + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-async-named-function.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-async-named-function.src.js.shot new file mode 100644 index 00000000000..db890c144b8 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-async-named-function.src.js.shot @@ -0,0 +1,270 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-default-async-named-function.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "async": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 38, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 30, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 15, + 38, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 29, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 33, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-class.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-class.src.js.shot new file mode 100644 index 00000000000..b5981d8975f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-class.src.js.shot @@ -0,0 +1,178 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-default-class.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 25, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": null, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 25, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-function.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-function.src.js.shot new file mode 100644 index 00000000000..45714a2fc63 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-function.src.js.shot @@ -0,0 +1,214 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-default-function.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 29, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 15, + 29, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 23, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-named-class.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-named-class.src.js.shot new file mode 100644 index 00000000000..023f6a95744 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-named-class.src.js.shot @@ -0,0 +1,216 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-default-named-class.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 30, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "Test", + "optional": false, + "range": Array [ + 21, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 30, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 25, + ], + "type": "Identifier", + "value": "Test", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-named-function.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-named-function.src.js.shot new file mode 100644 index 00000000000..2c546347ec2 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-named-function.src.js.shot @@ -0,0 +1,252 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-default-named-function.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 32, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 15, + 32, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 23, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-object.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-object.src.js.shot new file mode 100644 index 00000000000..096ea12c532 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-object.src.js.shot @@ -0,0 +1,270 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-default-object.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 17, + 23, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + }, + ], + "range": Array [ + 15, + 25, + ], + "type": "ObjectExpression", + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-value.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-value.src.js.shot new file mode 100644 index 00000000000..b740c7a1e51 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-default-value.src.js.shot @@ -0,0 +1,138 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-default-value.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-default.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-default.src.js.shot new file mode 100644 index 00000000000..50e668ba1b9 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-default.src.js.shot @@ -0,0 +1,254 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-from-default.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": null, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 27, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "default", + "optional": false, + "range": Array [ + 8, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "default", + "optional": false, + "range": Array [ + 8, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 8, + 15, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 15, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 27, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-named-as-default.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-named-as-default.src.js.shot new file mode 100644 index 00000000000..cb86e42ad9e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-named-as-default.src.js.shot @@ -0,0 +1,290 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-from-named-as-default.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": null, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 34, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "default", + "optional": false, + "range": Array [ + 15, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 8, + 22, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 22, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 28, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 34, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-named-as-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-named-as-specifier.src.js.shot new file mode 100644 index 00000000000..b6ea0ea5fd1 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-named-as-specifier.src.js.shot @@ -0,0 +1,290 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-from-named-as-specifier.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": null, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 30, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 8, + 18, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 24, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 30, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-named-as-specifiers.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-named-as-specifiers.src.js.shot new file mode 100644 index 00000000000..000d3159b7c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-named-as-specifiers.src.js.shot @@ -0,0 +1,386 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-from-named-as-specifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": null, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 39, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "default", + "optional": false, + "range": Array [ + 15, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 8, + 22, + ], + "type": "ExportSpecifier", + }, + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 24, + 27, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 22, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 33, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 39, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-specifier.src.js.shot new file mode 100644 index 00000000000..916b81714ee --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-specifier.src.js.shot @@ -0,0 +1,254 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-from-specifier.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": null, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 23, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 8, + 11, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 23, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-specifiers.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-specifiers.src.js.shot new file mode 100644 index 00000000000..3bf874bb4b0 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-from-specifiers.src.js.shot @@ -0,0 +1,350 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-from-specifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": null, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 28, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 8, + 11, + ], + "type": "ExportSpecifier", + }, + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 13, + 16, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 22, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 28, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-function.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-function.src.js.shot new file mode 100644 index 00000000000..1dc5377d498 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-function.src.js.shot @@ -0,0 +1,237 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-function.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 7, + 25, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-let.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-let.src.js.shot new file mode 100644 index 00000000000..a4710809ff3 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-let.src.js.shot @@ -0,0 +1,235 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-let.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 18, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 19, + ], + "type": "VariableDeclaration", + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-as-default.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-as-default.src.js.shot new file mode 100644 index 00000000000..475f0cc95b7 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-as-default.src.js.shot @@ -0,0 +1,236 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-named-as-default.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": null, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "source": null, + "specifiers": Array [ + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "default", + "optional": false, + "range": Array [ + 15, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 8, + 22, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 22, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-as-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-as-specifier.src.js.shot new file mode 100644 index 00000000000..0c1dc2f7845 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-as-specifier.src.js.shot @@ -0,0 +1,236 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-named-as-specifier.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": null, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "source": null, + "specifiers": Array [ + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 8, + 18, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-as-specifiers.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-as-specifiers.src.js.shot new file mode 100644 index 00000000000..0eafa54619c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-as-specifiers.src.js.shot @@ -0,0 +1,332 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-named-as-specifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": null, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "source": null, + "specifiers": Array [ + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "default", + "optional": false, + "range": Array [ + 15, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 8, + 22, + ], + "type": "ExportSpecifier", + }, + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 24, + 27, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 22, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-class.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-class.src.js.shot new file mode 100644 index 00000000000..ac9079f7fb6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-class.src.js.shot @@ -0,0 +1,201 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-named-class.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 22, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "Test", + "optional": false, + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 22, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + "value": "Test", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-specifier.src.js.shot new file mode 100644 index 00000000000..c8e5a2f8046 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-specifier.src.js.shot @@ -0,0 +1,200 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-named-specifier.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": null, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "source": null, + "specifiers": Array [ + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 8, + 11, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-specifiers-comma.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-specifiers-comma.src.js.shot new file mode 100644 index 00000000000..eaef4de89e8 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-specifiers-comma.src.js.shot @@ -0,0 +1,314 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-named-specifiers-comma.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": null, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "source": null, + "specifiers": Array [ + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 8, + 11, + ], + "type": "ExportSpecifier", + }, + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 13, + 16, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-specifiers.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-specifiers.src.js.shot new file mode 100644 index 00000000000..d46f4a043c9 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-named-specifiers.src.js.shot @@ -0,0 +1,296 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-named-specifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": null, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "source": null, + "specifiers": Array [ + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 8, + 11, + ], + "type": "ExportSpecifier", + }, + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 13, + 16, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-var-anonymous-function.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-var-anonymous-function.src.js.shot new file mode 100644 index 00000000000..5567c75a632 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-var-anonymous-function.src.js.shot @@ -0,0 +1,331 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-var-anonymous-function.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 17, + 31, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 31, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 32, + ], + "type": "VariableDeclaration", + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 25, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-var-number.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-var-number.src.js.shot new file mode 100644 index 00000000000..d9df301c497 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-var-number.src.js.shot @@ -0,0 +1,235 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-var-number.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 18, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 19, + ], + "type": "VariableDeclaration", + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/export-var.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/export-var.src.js.shot new file mode 100644 index 00000000000..aea42111a45 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/export-var.src.js.shot @@ -0,0 +1,181 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules export-var.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "VariableDeclaration", + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-default-and-named-specifiers.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-default-and-named-specifiers.src.js.shot new file mode 100644 index 00000000000..6cb4421767f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-default-and-named-specifiers.src.js.shot @@ -0,0 +1,327 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules import-default-and-named-specifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "value", + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 28, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 7, + 10, + ], + "type": "ImportDefaultSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 13, + 16, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 22, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 28, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-default-and-namespace-specifiers.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-default-and-namespace-specifiers.src.js.shot new file mode 100644 index 00000000000..0772f12cae1 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-default-and-namespace-specifiers.src.js.shot @@ -0,0 +1,305 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules import-default-and-namespace-specifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "value", + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 31, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 7, + 10, + ], + "type": "ImportDefaultSpecifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 12, + 20, + ], + "type": "ImportNamespaceSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 25, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 31, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-default-as.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-default-as.src.js.shot new file mode 100644 index 00000000000..9ddd682c0ef --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-default-as.src.js.shot @@ -0,0 +1,289 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules import-default-as.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "value", + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 34, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "default", + "optional": false, + "range": Array [ + 8, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 8, + 22, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 15, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 28, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 34, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-default.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-default.src.js.shot new file mode 100644 index 00000000000..730de4c6433 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-default.src.js.shot @@ -0,0 +1,195 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules import-default.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "value", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 7, + 10, + ], + "type": "ImportDefaultSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-jquery.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-jquery.src.js.shot new file mode 100644 index 00000000000..108e2b959ce --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-jquery.src.js.shot @@ -0,0 +1,177 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules import-jquery.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "value", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 22, + ], + "raw": "\\"jquery\\"", + "type": "Literal", + "value": "jquery", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "$", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 7, + 8, + ], + "type": "ImportDefaultSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "$", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 22, + ], + "type": "String", + "value": "\\"jquery\\"", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-as-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-as-specifier.src.js.shot new file mode 100644 index 00000000000..8ddcdd19ccc --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-as-specifier.src.js.shot @@ -0,0 +1,289 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules import-named-as-specifier.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "value", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 30, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 8, + 18, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 24, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 30, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-as-specifiers.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-as-specifiers.src.js.shot new file mode 100644 index 00000000000..ce8ce411d48 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-as-specifiers.src.js.shot @@ -0,0 +1,385 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules import-named-as-specifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "value", + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 35, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 8, + 18, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "xyz", + "optional": false, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "xyz", + "optional": false, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 20, + 23, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + "value": "xyz", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 29, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 35, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-specifier.src.js.shot new file mode 100644 index 00000000000..a0964248ed9 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-specifier.src.js.shot @@ -0,0 +1,253 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules import-named-specifier.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "value", + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 23, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 8, + 11, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 23, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-specifiers-comma.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-specifiers-comma.src.js.shot new file mode 100644 index 00000000000..9d3eea95559 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-specifiers-comma.src.js.shot @@ -0,0 +1,367 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules import-named-specifiers-comma.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "value", + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 29, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 8, + 11, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 13, + 16, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 29, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-specifiers.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-specifiers.src.js.shot new file mode 100644 index 00000000000..a9fc1aaa2ac --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-named-specifiers.src.js.shot @@ -0,0 +1,349 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules import-named-specifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "value", + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 28, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 8, + 11, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 13, + 16, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 22, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 28, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-namespace-specifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-namespace-specifier.src.js.shot new file mode 100644 index 00000000000..3885bff0653 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-namespace-specifier.src.js.shot @@ -0,0 +1,231 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules import-namespace-specifier.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "value", + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 26, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 7, + 15, + ], + "type": "ImportNamespaceSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 26, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/import-null-as-nil.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/import-null-as-nil.src.js.shot new file mode 100644 index 00000000000..6b390b59d10 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/import-null-as-nil.src.js.shot @@ -0,0 +1,271 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules import-null-as-nil.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "value", + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 33, + ], + "raw": "\\"bar\\"", + "type": "Literal", + "value": "bar", + }, + "specifiers": Array [ + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "null", + "optional": false, + "range": Array [ + 9, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "nil", + "optional": false, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 9, + 20, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "type": "Null", + "value": "null", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "nil", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 27, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 33, + ], + "type": "String", + "value": "\\"bar\\"", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-await.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-await.src.js.shot new file mode 100644 index 00000000000..96d37663dc8 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-await.src.js.shot @@ -0,0 +1,181 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules invalid-await.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "await", + "optional": false, + "range": Array [ + 11, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 17, + ], + "type": "VariableDeclaration", + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "Identifier", + "value": "await", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-class.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-class.src.js.shot new file mode 100644 index 00000000000..2f7c0444039 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-class.src.js.shot @@ -0,0 +1,178 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules invalid-class.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": null, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 23, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-named-default.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-named-default.src.js.shot new file mode 100644 index 00000000000..973ec845d90 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/modules/invalid-export-named-default.src.js.shot @@ -0,0 +1,182 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript modules invalid-export-named-default.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": null, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "source": null, + "specifiers": Array [ + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "default", + "optional": false, + "range": Array [ + 8, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "default", + "optional": false, + "range": Array [ + 8, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 8, + 15, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 15, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/newTarget/invalid-new-target.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/newTarget/invalid-new-target.src.js.shot new file mode 100644 index 00000000000..4967cdc601c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/newTarget/invalid-new-target.src.js.shot @@ -0,0 +1,272 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript newTarget invalid-new-target.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "meta": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "new", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "target", + "optional": false, + "range": Array [ + 12, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 8, + 18, + ], + "type": "MetaProperty", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 18, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 18, + ], + "type": "Identifier", + "value": "target", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/newTarget/invalid-unknown-property.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/newTarget/invalid-unknown-property.src.js.shot new file mode 100644 index 00000000000..ebe6c8183ee --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/newTarget/invalid-unknown-property.src.js.shot @@ -0,0 +1,424 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript newTarget invalid-unknown-property.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "meta": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "new", + "optional": false, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "unknown_property", + "optional": false, + "range": Array [ + 25, + 41, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 21, + 41, + ], + "type": "MetaProperty", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 42, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 44, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 8, + 44, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 44, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 16, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 41, + ], + "type": "Identifier", + "value": "unknown_property", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/newTarget/simple-new-target.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/newTarget/simple-new-target.src.js.shot new file mode 100644 index 00000000000..fa677626c02 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/newTarget/simple-new-target.src.js.shot @@ -0,0 +1,444 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript newTarget simple-new-target.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "meta": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "name": "new", + "optional": false, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "target", + "optional": false, + "range": Array [ + 31, + 37, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 27, + 37, + ], + "type": "MetaProperty", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 23, + 37, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 38, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 40, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 40, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "Identifier", + "value": "target", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteral/object-literal-in-lhs.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteral/object-literal-in-lhs.src.js.shot new file mode 100644 index 00000000000..61801e02fb7 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteral/object-literal-in-lhs.src.js.shot @@ -0,0 +1,364 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript objectLiteral object-literal-in-lhs.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "object": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 3, + 5, + ], + "type": "ObjectExpression", + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "fn", + "optional": false, + "range": Array [ + 0, + 2, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 6, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 0, + 8, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 14, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "obj", + "optional": false, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 2, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "value": "obj", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-addition-property.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-addition-property.src.js.shot new file mode 100644 index 00000000000..c47f0ad24b4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-addition-property.src.js.shot @@ -0,0 +1,439 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript objectLiteralComputedProperties computed-addition-property.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "operator": "+", + "range": Array [ + 15, + 20, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "type": "BinaryExpression", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 14, + 26, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 23, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 8, + 28, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 28, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-and-identifier.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-and-identifier.src.js.shot new file mode 100644 index 00000000000..54c3293f26f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-and-identifier.src.js.shot @@ -0,0 +1,440 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript objectLiteralComputedProperties computed-and-identifier.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 2, + 9, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 11, + 16, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "raw": "20", + "type": "Literal", + "value": 20, + }, + }, + ], + "range": Array [ + 1, + 17, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "Numeric", + "value": "20", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-getter-and-setter.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-getter-and-setter.src.js.shot new file mode 100644 index 00000000000..0d6c9eeb70c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-getter-and-setter.src.js.shot @@ -0,0 +1,672 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript objectLiteralComputedProperties computed-getter-and-setter.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 2, + 14, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 9, + 14, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "computed": true, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 16, + 29, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 29, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "v", + "optional": false, + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 23, + 29, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "range": Array [ + 1, + 30, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 5, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + "value": "v", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-string-property.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-string-property.src.js.shot new file mode 100644 index 00000000000..9a5d4eb3996 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-string-property.src.js.shot @@ -0,0 +1,366 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript objectLiteralComputedProperties computed-string-property.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 20, + ], + "raw": "\\"hey\\"", + "type": "Literal", + "value": "hey", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 14, + 26, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 23, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 8, + 28, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 28, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "String", + "value": "\\"hey\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-variable-property.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-variable-property.src.js.shot new file mode 100644 index 00000000000..7c627afaf31 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/computed-variable-property.src.js.shot @@ -0,0 +1,368 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript objectLiteralComputedProperties computed-variable-property.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 14, + 24, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 8, + 26, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 26, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/standalone-expression-with-addition.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/standalone-expression-with-addition.src.js.shot new file mode 100644 index 00000000000..53c49f1bc19 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/standalone-expression-with-addition.src.js.shot @@ -0,0 +1,377 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript objectLiteralComputedProperties standalone-expression-with-addition.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 6, + ], + "raw": "\\"x\\"", + "type": "Literal", + "value": "x", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "operator": "+", + "range": Array [ + 3, + 12, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "raw": "\\"y\\"", + "type": "Literal", + "value": "y", + }, + "type": "BinaryExpression", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 2, + 17, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 17, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + }, + ], + "range": Array [ + 1, + 18, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 6, + ], + "type": "String", + "value": "\\"x\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "String", + "value": "\\"y\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 17, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/standalone-expression-with-method.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/standalone-expression-with-method.src.js.shot new file mode 100644 index 00000000000..6581e09d016 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/standalone-expression-with-method.src.js.shot @@ -0,0 +1,402 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript objectLiteralComputedProperties standalone-expression-with-method.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 2, + 20, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 7, + 20, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "range": Array [ + 1, + 21, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/standalone-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/standalone-expression.src.js.shot new file mode 100644 index 00000000000..ee112a09ec2 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralComputedProperties/standalone-expression.src.js.shot @@ -0,0 +1,306 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript objectLiteralComputedProperties standalone-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 2, + 9, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + }, + ], + "range": Array [ + 1, + 10, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/error-proto-property.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/error-proto-property.src.js.shot new file mode 100644 index 00000000000..de9baf959f3 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/error-proto-property.src.js.shot @@ -0,0 +1,727 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript objectLiteralDuplicateProperties error-proto-property.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "proto", + "optional": false, + "range": Array [ + 19, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "properties": Array [], + "range": Array [ + 27, + 29, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 19, + 29, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 15, + 30, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "name": "__proto__", + "optional": false, + "range": Array [ + 43, + 52, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 43, + 59, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "name": "proto", + "optional": false, + "range": Array [ + 54, + 59, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "name": "__proto__", + "optional": false, + "range": Array [ + 62, + 71, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 62, + 78, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "name": "proto", + "optional": false, + "range": Array [ + 73, + 78, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 40, + 80, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 36, + 80, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 32, + 81, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 81, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "Identifier", + "value": "proto", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "range": Array [ + 43, + 52, + ], + "type": "Identifier", + "value": "__proto__", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 54, + 59, + ], + "type": "Identifier", + "value": "proto", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "range": Array [ + 62, + 71, + ], + "type": "Identifier", + "value": "__proto__", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 73, + 78, + ], + "type": "Identifier", + "value": "proto", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 8, + }, + "start": Object { + "column": 1, + "line": 8, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/error-proto-string-property.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/error-proto-string-property.src.js.shot new file mode 100644 index 00000000000..d9c3b6ab645 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/error-proto-string-property.src.js.shot @@ -0,0 +1,723 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript objectLiteralDuplicateProperties error-proto-string-property.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "proto", + "optional": false, + "range": Array [ + 19, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "properties": Array [], + "range": Array [ + 27, + 29, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 19, + 29, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 15, + 30, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "range": Array [ + 43, + 54, + ], + "raw": "\\"__proto__\\"", + "type": "Literal", + "value": "__proto__", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 43, + 61, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "name": "proto", + "optional": false, + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "range": Array [ + 64, + 75, + ], + "raw": "\\"__proto__\\"", + "type": "Literal", + "value": "__proto__", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 64, + 82, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "name": "proto", + "optional": false, + "range": Array [ + 77, + 82, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 40, + 84, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 36, + 84, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 32, + 85, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 85, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "Identifier", + "value": "proto", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "range": Array [ + 43, + 54, + ], + "type": "String", + "value": "\\"__proto__\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + "value": "proto", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "range": Array [ + 64, + 75, + ], + "type": "String", + "value": "\\"__proto__\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 77, + 82, + ], + "type": "Identifier", + "value": "proto", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 8, + }, + "start": Object { + "column": 1, + "line": 8, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/strict-duplicate-properties.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/strict-duplicate-properties.src.js.shot new file mode 100644 index 00000000000..920a5e9de72 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/strict-duplicate-properties.src.js.shot @@ -0,0 +1,537 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript objectLiteralDuplicateProperties strict-duplicate-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 26, + 36, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 29, + 36, + ], + "raw": "'first'", + "type": "Literal", + "value": "first", + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 39, + 50, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 42, + 50, + ], + "raw": "'second'", + "type": "Literal", + "value": "second", + }, + }, + ], + "range": Array [ + 23, + 52, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 19, + 52, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 15, + 53, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 53, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 29, + 36, + ], + "type": "String", + "value": "'first'", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 42, + 50, + ], + "type": "String", + "value": "'second'", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/strict-duplicate-string-properties.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/strict-duplicate-string-properties.src.js.shot new file mode 100644 index 00000000000..317b960150f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralDuplicateProperties/strict-duplicate-string-properties.src.js.shot @@ -0,0 +1,533 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript objectLiteralDuplicateProperties strict-duplicate-string-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 26, + 29, + ], + "raw": "\\"y\\"", + "type": "Literal", + "value": "y", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 26, + 38, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 31, + 38, + ], + "raw": "\\"first\\"", + "type": "Literal", + "value": "first", + }, + }, + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 41, + 44, + ], + "raw": "\\"y\\"", + "type": "Literal", + "value": "y", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 41, + 54, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 46, + 54, + ], + "raw": "\\"second\\"", + "type": "Literal", + "value": "second", + }, + }, + ], + "range": Array [ + 23, + 56, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 19, + 56, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 15, + 57, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 57, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "String", + "value": "\\"y\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "String", + "value": "\\"first\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 41, + 44, + ], + "type": "String", + "value": "\\"y\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 46, + 54, + ], + "type": "String", + "value": "\\"second\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/method-property.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/method-property.src.js.shot new file mode 100644 index 00000000000..ac8abefcf16 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/method-property.src.js.shot @@ -0,0 +1,483 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript objectLiteralShorthandMethods method-property.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": true, + "optional": false, + "range": Array [ + 14, + 47, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 37, + 40, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 30, + 41, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 47, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 17, + 47, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "range": Array [ + 8, + 49, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 49, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 37, + 40, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-named-get.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-named-get.src.js.shot new file mode 100644 index 00000000000..b51e058983a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-named-get.src.js.shot @@ -0,0 +1,404 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript objectLiteralShorthandMethods simple-method-named-get.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 25, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "get", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": true, + "optional": false, + "range": Array [ + 10, + 23, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 13, + 23, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "range": Array [ + 4, + 25, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "ExpressionStatement", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-named-set.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-named-set.src.js.shot new file mode 100644 index 00000000000..acd890e7ed1 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-named-set.src.js.shot @@ -0,0 +1,404 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript objectLiteralShorthandMethods simple-method-named-set.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 25, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "set", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": true, + "optional": false, + "range": Array [ + 10, + 23, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 13, + 23, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "range": Array [ + 4, + 25, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "ExpressionStatement", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-with-argument.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-with-argument.src.js.shot new file mode 100644 index 00000000000..91e5ad3aece --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-with-argument.src.js.shot @@ -0,0 +1,444 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript objectLiteralShorthandMethods simple-method-with-argument.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 33, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "method", + "optional": false, + "range": Array [ + 10, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": true, + "optional": false, + "range": Array [ + 10, + 31, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 23, + 31, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "test", + "optional": false, + "range": Array [ + 17, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 16, + 31, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "range": Array [ + 4, + 33, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "type": "ExpressionStatement", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 16, + ], + "type": "Identifier", + "value": "method", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-with-string-name.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-with-string-name.src.js.shot new file mode 100644 index 00000000000..8f207cc58c7 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method-with-string-name.src.js.shot @@ -0,0 +1,402 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript objectLiteralShorthandMethods simple-method-with-string-name.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 30, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 18, + ], + "raw": "\\"method\\"", + "type": "Literal", + "value": "method", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": true, + "optional": false, + "range": Array [ + 10, + 28, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 21, + 28, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 18, + 28, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "range": Array [ + 4, + 30, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "ExpressionStatement", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 18, + ], + "type": "String", + "value": "\\"method\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method.src.js.shot new file mode 100644 index 00000000000..c56f1df59d0 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/simple-method.src.js.shot @@ -0,0 +1,404 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript objectLiteralShorthandMethods simple-method.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 28, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "method", + "optional": false, + "range": Array [ + 10, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": true, + "optional": false, + "range": Array [ + 10, + 26, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 19, + 26, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 16, + 26, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "range": Array [ + 4, + 28, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "ExpressionStatement", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 16, + ], + "type": "Identifier", + "value": "method", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/string-name-method-property.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/string-name-method-property.src.js.shot new file mode 100644 index 00000000000..04671139283 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandMethods/string-name-method-property.src.js.shot @@ -0,0 +1,481 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript objectLiteralShorthandMethods string-name-method-property.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": true, + "optional": false, + "range": Array [ + 14, + 49, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 32, + 43, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 49, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 19, + 49, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "range": Array [ + 8, + 51, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 51, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 53, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandProperties/shorthand-properties.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandProperties/shorthand-properties.src.js.shot new file mode 100644 index 00000000000..7c826870297 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/objectLiteralShorthandProperties/shorthand-properties.src.js.shot @@ -0,0 +1,763 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript objectLiteralShorthandProperties shorthand-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "VariableDeclarator", + }, + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "get", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "VariableDeclarator", + }, + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "set", + "optional": false, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 42, + 45, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "name": "get", + "optional": false, + "range": Array [ + 51, + 54, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 51, + 54, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "name": "get", + "optional": false, + "range": Array [ + 51, + 54, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "name": "set", + "optional": false, + "range": Array [ + 60, + 63, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 60, + 63, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "name": "set", + "optional": false, + "range": Array [ + 60, + 63, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 36, + 65, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 32, + 65, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 28, + 66, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 67, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 51, + 54, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 60, + 63, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 1, + "line": 9, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/legacy.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/legacy.src.js.shot new file mode 100644 index 00000000000..d9a01d35b84 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/legacy.src.js.shot @@ -0,0 +1,100 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript octalLiterals legacy.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "raw": "02343", + "type": "Literal", + "value": 2343, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Numeric", + "value": "02343", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/lowercase.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/lowercase.src.js.shot new file mode 100644 index 00000000000..13e2d73d019 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/lowercase.src.js.shot @@ -0,0 +1,100 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript octalLiterals lowercase.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "raw": "0o717", + "type": "Literal", + "value": 463, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Numeric", + "value": "0o717", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/strict-uppercase.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/strict-uppercase.src.js.shot new file mode 100644 index 00000000000..100aec417a9 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/strict-uppercase.src.js.shot @@ -0,0 +1,173 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript octalLiterals strict-uppercase.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "raw": "0O717", + "type": "Literal", + "value": 463, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "type": "Numeric", + "value": "0O717", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/uppercase.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/uppercase.src.js.shot new file mode 100644 index 00000000000..add712ad5ca --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/octalLiterals/uppercase.src.js.shot @@ -0,0 +1,100 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript octalLiterals uppercase.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "raw": "0O717", + "type": "Literal", + "value": 463, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Numeric", + "value": "0O717", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/regex/regexp-simple.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/regex/regexp-simple.src.js.shot new file mode 100644 index 00000000000..3a74ee35b2c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/regex/regexp-simple.src.js.shot @@ -0,0 +1,204 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript regex regexp-simple.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "raw": "/foo./", + "regex": Object { + "flags": "", + "pattern": "foo.", + }, + "type": "Literal", + "value": /foo\\./, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "regex": Object { + "flags": "", + "pattern": "foo.", + }, + "type": "RegularExpression", + "value": "/foo./", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/regexUFlag/regex-u-extended-escape.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/regexUFlag/regex-u-extended-escape.src.js.shot new file mode 100644 index 00000000000..2e40921f14f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/regexUFlag/regex-u-extended-escape.src.js.shot @@ -0,0 +1,204 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript regexUFlag regex-u-extended-escape.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 40, + ], + "raw": "/[\\\\u{0000000000000061}-\\\\u{7A}]/u", + "regex": Object { + "flags": "u", + "pattern": "[\\\\u{0000000000000061}-\\\\u{7A}]", + }, + "type": "Literal", + "value": /\\[\\\\u\\{0000000000000061\\}-\\\\u\\{7A\\}\\]/u, + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 40, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 40, + ], + "regex": Object { + "flags": "u", + "pattern": "[\\\\u{0000000000000061}-\\\\u{7A}]", + }, + "type": "RegularExpression", + "value": "/[\\\\u{0000000000000061}-\\\\u{7A}]/u", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/regexUFlag/regex-u-invalid-extended-escape.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/regexUFlag/regex-u-invalid-extended-escape.src.js.shot new file mode 100644 index 00000000000..947b615da57 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/regexUFlag/regex-u-invalid-extended-escape.src.js.shot @@ -0,0 +1,204 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript regexUFlag regex-u-invalid-extended-escape.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 21, + ], + "raw": "/\\\\u{110000}/u", + "regex": Object { + "flags": "u", + "pattern": "\\\\u{110000}", + }, + "type": "Literal", + "value": null, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 21, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 21, + ], + "regex": Object { + "flags": "u", + "pattern": "\\\\u{110000}", + }, + "type": "RegularExpression", + "value": "/\\\\u{110000}/u", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/regexUFlag/regex-u-simple.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/regexUFlag/regex-u-simple.src.js.shot new file mode 100644 index 00000000000..981db5e3138 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/regexUFlag/regex-u-simple.src.js.shot @@ -0,0 +1,204 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript regexUFlag regex-u-simple.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "raw": "/foo/u", + "regex": Object { + "flags": "u", + "pattern": "foo", + }, + "type": "Literal", + "value": /foo/u, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "regex": Object { + "flags": "u", + "pattern": "foo", + }, + "type": "RegularExpression", + "value": "/foo/u", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/regexYFlag/regexp-y-simple.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/regexYFlag/regexp-y-simple.src.js.shot new file mode 100644 index 00000000000..b08d9329097 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/regexYFlag/regexp-y-simple.src.js.shot @@ -0,0 +1,204 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript regexYFlag regexp-y-simple.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "raw": "/foo/y", + "regex": Object { + "flags": "y", + "pattern": "foo", + }, + "type": "Literal", + "value": /foo/y, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "regex": Object { + "flags": "y", + "pattern": "foo", + }, + "type": "RegularExpression", + "value": "/foo/y", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/restParams/basic-rest.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/restParams/basic-rest.src.js.shot new file mode 100644 index 00000000000..39322db7325 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/restParams/basic-rest.src.js.shot @@ -0,0 +1,369 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript restParams basic-rest.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 14, + 18, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 0, + 22, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/restParams/class-constructor.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/restParams/class-constructor.src.js.shot new file mode 100644 index 00000000000..2901e45bc45 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/restParams/class-constructor.src.js.shot @@ -0,0 +1,421 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript restParams class-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 41, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 26, + 32, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 25, + 41, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 43, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/restParams/class-method.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/restParams/class-method.src.js.shot new file mode 100644 index 00000000000..249307c64cd --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/restParams/class-method.src.js.shot @@ -0,0 +1,421 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript restParams class-method.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 33, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 33, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 18, + 24, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 17, + 33, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 35, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/restParams/error-no-default.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/restParams/error-no-default.src.js.shot new file mode 100644 index 00000000000..6e86567b8cd --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/restParams/error-no-default.src.js.shot @@ -0,0 +1,335 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript restParams error-no-default.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": undefined, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 14, + 22, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 0, + 24, + ], + "returnType": undefined, + "type": "TSDeclareFunction", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/restParams/error-not-last.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/restParams/error-not-last.src.js.shot new file mode 100644 index 00000000000..0c78d497d6e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/restParams/error-not-last.src.js.shot @@ -0,0 +1,356 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript restParams error-not-last.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": undefined, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 14, + 18, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 23, + ], + "returnType": undefined, + "type": "TSDeclareFunction", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/restParams/func-expression-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/restParams/func-expression-multi.src.js.shot new file mode 100644 index 00000000000..f261603beb4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/restParams/func-expression-multi.src.js.shot @@ -0,0 +1,428 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript restParams func-expression-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 20, + 24, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 8, + 28, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 28, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 16, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/restParams/func-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/restParams/func-expression.src.js.shot new file mode 100644 index 00000000000..1a51980f118 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/restParams/func-expression.src.js.shot @@ -0,0 +1,371 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript restParams func-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "params": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 18, + 22, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 8, + 26, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 26, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 16, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/restParams/invalid-rest-param.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/restParams/invalid-rest-param.src.js.shot new file mode 100644 index 00000000000..ba57015fedb --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/restParams/invalid-rest-param.src.js.shot @@ -0,0 +1,413 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript restParams invalid-rest-param.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 16, + 17, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 14, + 19, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 11, + 19, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 0, + 22, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/restParams/single-rest.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/restParams/single-rest.src.js.shot new file mode 100644 index 00000000000..6b61e28e0f0 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/restParams/single-rest.src.js.shot @@ -0,0 +1,312 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript restParams single-rest.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 19, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 11, + 15, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 0, + 19, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-float-negative.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-float-negative.src.js.shot new file mode 100644 index 00000000000..1dab848b1c8 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-float-negative.src.js.shot @@ -0,0 +1,233 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript simple-literals literal-float-negative.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "raw": "1.5", + "type": "Literal", + "value": 1.5, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "operator": "-", + "prefix": true, + "range": Array [ + 10, + 14, + ], + "type": "UnaryExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "-", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Numeric", + "value": "1.5", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-float.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-float.src.js.shot new file mode 100644 index 00000000000..321bd41c275 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-float.src.js.shot @@ -0,0 +1,196 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript simple-literals literal-float.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "raw": "1.5", + "type": "Literal", + "value": 1.5, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 13, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Numeric", + "value": "1.5", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-null.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-null.src.js.shot new file mode 100644 index 00000000000..d3158faf630 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-null.src.js.shot @@ -0,0 +1,196 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript simple-literals literal-null.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "raw": "null", + "type": "Literal", + "value": null, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Keyword", + "value": "null", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-number-negative.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-number-negative.src.js.shot new file mode 100644 index 00000000000..91d536ffc5c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-number-negative.src.js.shot @@ -0,0 +1,233 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript simple-literals literal-number-negative.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "operator": "-", + "prefix": true, + "range": Array [ + 10, + 12, + ], + "type": "UnaryExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 12, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "-", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-number.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-number.src.js.shot new file mode 100644 index 00000000000..a7d510f263b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-number.src.js.shot @@ -0,0 +1,196 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript simple-literals literal-number.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-string.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-string.src.js.shot new file mode 100644 index 00000000000..9571bcdd0a8 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-string.src.js.shot @@ -0,0 +1,196 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript simple-literals literal-string.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "raw": "'a'", + "type": "Literal", + "value": "a", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 13, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "String", + "value": "'a'", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-undefined.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-undefined.src.js.shot new file mode 100644 index 00000000000..0c399b54fe0 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/simple-literals/literal-undefined.src.js.shot @@ -0,0 +1,198 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript simple-literals literal-undefined.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "undefined", + "optional": false, + "range": Array [ + 10, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 19, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 19, + ], + "type": "Identifier", + "value": "undefined", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/spread/complex-spread.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/spread/complex-spread.src.js.shot new file mode 100644 index 00000000000..253a15279e6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/spread/complex-spread.src.js.shot @@ -0,0 +1,1732 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript spread complex-spread.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 102, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 2, + 22, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "ka", + "optional": false, + "range": Array [ + 7, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 7, + 9, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "ka", + "optional": false, + "range": Array [ + 7, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "nested", + "optional": false, + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 11, + 20, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 5, + 22, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 24, + 32, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": "other", + "optional": false, + "range": Array [ + 27, + 32, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 92, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 34, + 92, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 92, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 39, + 64, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 57, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 48, + "line": 1, + }, + }, + "name": "nested2", + "optional": false, + "range": Array [ + 48, + 55, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 45, + 55, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 43, + 57, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 63, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 62, + 63, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 63, + "line": 1, + }, + "start": Object { + "column": 59, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 59, + 63, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 42, + 64, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 67, + "line": 1, + }, + "start": Object { + "column": 66, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 66, + 67, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 66, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 66, + 80, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 69, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 72, + "line": 1, + }, + "start": Object { + "column": 71, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 71, + 72, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 72, + "line": 1, + }, + "start": Object { + "column": 71, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 71, + 72, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 72, + "line": 1, + }, + "start": Object { + "column": 71, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 71, + 72, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 78, + "line": 1, + }, + "start": Object { + "column": 77, + "line": 1, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 77, + 78, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 78, + "line": 1, + }, + "start": Object { + "column": 74, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 74, + 78, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 69, + 80, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 90, + "line": 1, + }, + "start": Object { + "column": 85, + "line": 1, + }, + }, + "name": "rest2", + "optional": false, + "range": Array [ + 85, + 90, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 90, + "line": 1, + }, + "start": Object { + "column": 82, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 82, + 90, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 37, + 92, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 101, + "line": 1, + }, + "start": Object { + "column": 97, + "line": 1, + }, + }, + "name": "rest", + "optional": false, + "range": Array [ + 97, + 101, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 101, + "line": 1, + }, + "start": Object { + "column": 94, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 94, + 101, + ], + "type": "RestElement", + "typeAnnotation": undefined, + "value": undefined, + }, + ], + "range": Array [ + 1, + 102, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 112, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 1, + 112, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 112, + "line": 1, + }, + "start": Object { + "column": 105, + "line": 1, + }, + }, + "name": "complex", + "optional": false, + "range": Array [ + 105, + 112, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 114, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 114, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 115, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Identifier", + "value": "ka", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + "value": "nested", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 32, + ], + "type": "Identifier", + "value": "other", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 48, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 48, + "line": 1, + }, + }, + "range": Array [ + 48, + 55, + ], + "type": "Identifier", + "value": "nested2", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 1, + }, + "start": Object { + "column": 56, + "line": 1, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 1, + }, + "start": Object { + "column": 57, + "line": 1, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 62, + "line": 1, + }, + "start": Object { + "column": 59, + "line": 1, + }, + }, + "range": Array [ + 59, + 62, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 63, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 63, + "line": 1, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 1, + }, + "start": Object { + "column": 64, + "line": 1, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 67, + "line": 1, + }, + "start": Object { + "column": 66, + "line": 1, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 67, + "line": 1, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 70, + "line": 1, + }, + "start": Object { + "column": 69, + "line": 1, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 72, + "line": 1, + }, + "start": Object { + "column": 71, + "line": 1, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 1, + }, + "start": Object { + "column": 72, + "line": 1, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 74, + "line": 1, + }, + }, + "range": Array [ + 74, + 77, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 78, + "line": 1, + }, + "start": Object { + "column": 77, + "line": 1, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 79, + "line": 1, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 81, + "line": 1, + }, + "start": Object { + "column": 80, + "line": 1, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 85, + "line": 1, + }, + "start": Object { + "column": 82, + "line": 1, + }, + }, + "range": Array [ + 82, + 85, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 90, + "line": 1, + }, + "start": Object { + "column": 85, + "line": 1, + }, + }, + "range": Array [ + 85, + 90, + ], + "type": "Identifier", + "value": "rest2", + }, + Object { + "loc": Object { + "end": Object { + "column": 92, + "line": 1, + }, + "start": Object { + "column": 91, + "line": 1, + }, + }, + "range": Array [ + 91, + 92, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 93, + "line": 1, + }, + "start": Object { + "column": 92, + "line": 1, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 97, + "line": 1, + }, + "start": Object { + "column": 94, + "line": 1, + }, + }, + "range": Array [ + 94, + 97, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 101, + "line": 1, + }, + "start": Object { + "column": 97, + "line": 1, + }, + }, + "range": Array [ + 97, + 101, + ], + "type": "Identifier", + "value": "rest", + }, + Object { + "loc": Object { + "end": Object { + "column": 102, + "line": 1, + }, + "start": Object { + "column": 101, + "line": 1, + }, + }, + "range": Array [ + 101, + 102, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 104, + "line": 1, + }, + "start": Object { + "column": 103, + "line": 1, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 112, + "line": 1, + }, + "start": Object { + "column": 105, + "line": 1, + }, + }, + "range": Array [ + 105, + 112, + ], + "type": "Identifier", + "value": "complex", + }, + Object { + "loc": Object { + "end": Object { + "column": 113, + "line": 1, + }, + "start": Object { + "column": 112, + "line": 1, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 114, + "line": 1, + }, + "start": Object { + "column": 113, + "line": 1, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/spread/multi-function-call.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/spread/multi-function-call.src.js.shot new file mode 100644 index 00000000000..f0166dcd049 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/spread/multi-function-call.src.js.shot @@ -0,0 +1,290 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript spread multi-function-call.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "SpreadElement", + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 12, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/spread/not-final-param.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/spread/not-final-param.src.js.shot new file mode 100644 index 00000000000..e8b0a543bbf --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/spread/not-final-param.src.js.shot @@ -0,0 +1,290 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript spread not-final-param.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 9, + ], + "type": "SpreadElement", + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "func", + "optional": false, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 13, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "func", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/spread/simple-function-call.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/spread/simple-function-call.src.js.shot new file mode 100644 index 00000000000..5d200dab46b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/spread/simple-function-call.src.js.shot @@ -0,0 +1,233 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript spread simple-function-call.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 8, + ], + "type": "SpreadElement", + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 9, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/deeply-nested.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/deeply-nested.src.js.shot new file mode 100644 index 00000000000..1dca3524497 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/deeply-nested.src.js.shot @@ -0,0 +1,472 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript templateStrings deeply-nested.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "quasi": Object { + "expressions": Array [ + Object { + "expressions": Array [ + Object { + "left": Object { + "expressions": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 30, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "deeply", + "raw": "deeply", + }, + }, + ], + "range": Array [ + 22, + 30, + ], + "type": "TemplateLiteral", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "operator": "+", + "range": Array [ + 22, + 35, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 33, + 35, + ], + "type": "ObjectExpression", + }, + "type": "BinaryExpression", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 22, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": "nested ", + "raw": "nested ", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 42, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": " blah", + "raw": " blah", + }, + }, + ], + "range": Array [ + 12, + 42, + ], + "type": "TemplateLiteral", + }, + ], + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 12, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": "hello ", + "raw": "hello ", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 44, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "", + "raw": "", + }, + }, + ], + "range": Array [ + 3, + 44, + ], + "type": "TemplateLiteral", + }, + "range": Array [ + 0, + 44, + ], + "tag": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "raw", + "optional": false, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "TaggedTemplateExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 46, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "raw", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 12, + ], + "type": "Template", + "value": "\`hello \${", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 22, + ], + "type": "Template", + "value": "\`nested \${", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 30, + ], + "type": "Template", + "value": "\`deeply\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 42, + ], + "type": "Template", + "value": "} blah\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 44, + ], + "type": "Template", + "value": "}\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/error-octal-literal.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/error-octal-literal.src.js.shot new file mode 100644 index 00000000000..c0bdaa76c24 Binary files /dev/null and b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/error-octal-literal.src.js.shot differ diff --git a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/escape-characters.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/escape-characters.src.js.shot new file mode 100644 index 00000000000..a381e89f5c3 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/escape-characters.src.js.shot @@ -0,0 +1,221 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript templateStrings escape-characters.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "ts", + "optional": false, + "range": Array [ + 4, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "expressions": Array [], + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 39, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "\\\\n\\\\r\\\\b\\\\v\\\\t\\\\f\\\\ +\\\\ +", + "raw": "\\\\\\\\n\\\\\\\\r\\\\\\\\b\\\\\\\\v\\\\\\\\t\\\\\\\\f\\\\\\\\\\\\n\\\\\\\\\\\\r\\\\n", + }, + }, + ], + "range": Array [ + 9, + 39, + ], + "type": "TemplateLiteral", + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 39, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 6, + ], + "type": "Identifier", + "value": "ts", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 39, + ], + "type": "Template", + "value": "\`\\\\\\\\n\\\\\\\\r\\\\\\\\b\\\\\\\\v\\\\\\\\t\\\\\\\\f\\\\\\\\\\\\n\\\\\\\\\\\\r\\\\n\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/expressions.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/expressions.src.js.shot new file mode 100644 index 00000000000..4743997f153 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/expressions.src.js.shot @@ -0,0 +1,693 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript templateStrings expressions.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 9, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "raw": "'Fred'", + "type": "Literal", + "value": "Fred", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 15, + 25, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 11, + 26, + ], + "type": "VariableDeclaration", + }, + Object { + "directive": undefined, + "expression": Object { + "expressions": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 51, + 52, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "operator": "+", + "range": Array [ + 51, + 56, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "type": "BinaryExpression", + }, + ], + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 28, + 37, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": "Hello ", + "raw": "Hello ", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 38, + 51, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": ". a + 5 = ", + "raw": ". a + 5 = ", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 56, + 58, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "", + "raw": "", + }, + }, + ], + "range": Array [ + 28, + 58, + ], + "type": "TemplateLiteral", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 28, + 59, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 59, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "String", + "value": "'Fred'", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 28, + 37, + ], + "type": "Template", + "value": "\`Hello \${", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 38, + 51, + ], + "type": "Template", + "value": "}. a + 5 = \${", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 56, + 58, + ], + "type": "Template", + "value": "}\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/multi-line-template-string.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/multi-line-template-string.src.js.shot new file mode 100644 index 00000000000..9a30e51cc75 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/multi-line-template-string.src.js.shot @@ -0,0 +1,138 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript templateStrings multi-line-template-string.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "expressions": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 110, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "The last man on Earth + sat alone in a room. + There was + a knock + on the + door...", + "raw": "The last man on Earth + sat alone in a room. + There was + a knock + on the + door...", + }, + }, + ], + "range": Array [ + 0, + 110, + ], + "type": "TemplateLiteral", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 111, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 111, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 110, + ], + "type": "Template", + "value": "\`The last man on Earth + sat alone in a room. + There was + a knock + on the + door...\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/simple-template-string.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/simple-template-string.src.js.shot new file mode 100644 index 00000000000..a1bda1978fc --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/simple-template-string.src.js.shot @@ -0,0 +1,123 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript templateStrings simple-template-string.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "expressions": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "42", + "raw": "42", + }, + }, + ], + "range": Array [ + 0, + 4, + ], + "type": "TemplateLiteral", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Template", + "value": "\`42\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/single-dollar-sign.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/single-dollar-sign.src.js.shot new file mode 100644 index 00000000000..ce91f2b68e8 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/single-dollar-sign.src.js.shot @@ -0,0 +1,219 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript templateStrings single-dollar-sign.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "ts", + "optional": false, + "range": Array [ + 4, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "expressions": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "$", + "raw": "$", + }, + }, + ], + "range": Array [ + 9, + 12, + ], + "type": "TemplateLiteral", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 12, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 6, + ], + "type": "Identifier", + "value": "ts", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Template", + "value": "\`$\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/tagged-no-placeholders.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/tagged-no-placeholders.src.js.shot new file mode 100644 index 00000000000..8e394cf8b1a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/tagged-no-placeholders.src.js.shot @@ -0,0 +1,180 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript templateStrings tagged-no-placeholders.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "quasi": Object { + "expressions": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 8, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "foo", + "raw": "foo", + }, + }, + ], + "range": Array [ + 3, + 8, + ], + "type": "TemplateLiteral", + }, + "range": Array [ + 0, + 8, + ], + "tag": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "TaggedTemplateExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 8, + ], + "type": "Template", + "value": "\`foo\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/templateStrings/tagged-template-string.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/tagged-template-string.src.js.shot new file mode 100644 index 00000000000..4e7c500f305 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/templateStrings/tagged-template-string.src.js.shot @@ -0,0 +1,758 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript templateStrings tagged-template-string.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "arguments", + "optional": false, + "range": Array [ + 30, + 39, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "name": "console", + "optional": false, + "range": Array [ + 18, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "log", + "optional": false, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 18, + 29, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 18, + 40, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 18, + 41, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 43, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "tag", + "optional": false, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 43, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "quasi": Object { + "expressions": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 55, + 56, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 71, + 72, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 47, + 55, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": "a is ", + "raw": "a is ", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 56, + 71, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": " while b is ", + "raw": " while b is ", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 72, + 75, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": ".", + "raw": ".", + }, + }, + ], + "range": Array [ + 47, + 75, + ], + "type": "TemplateLiteral", + }, + "range": Array [ + 44, + 75, + ], + "tag": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "name": "tag", + "optional": false, + "range": Array [ + 44, + 47, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "TaggedTemplateExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 44, + 76, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 76, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "tag", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 18, + 25, + ], + "type": "Identifier", + "value": "console", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "log", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 30, + 39, + ], + "type": "Identifier", + "value": "arguments", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 44, + 47, + ], + "type": "Identifier", + "value": "tag", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 47, + 55, + ], + "type": "Template", + "value": "\`a is \${", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 56, + 71, + ], + "type": "Template", + "value": "} while b is \${", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 72, + 75, + ], + "type": "Template", + "value": "}.\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 31, + "line": 4, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/ignored.src.js.shot b/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/ignored.src.js.shot new file mode 100644 index 00000000000..6fa4ff6603d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/javascript/unicodeCodePointEscapes/ignored.src.js.shot @@ -0,0 +1,1753 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`javascript unicodeCodePointEscapes ignored.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "raw": "' '", + "type": "Literal", + "value": " ", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 13, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 23, + 26, + ], + "raw": "' '", + "type": "Literal", + "value": " ", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 26, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 15, + 27, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "d", + "optional": false, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 36, + 43, + ], + "raw": "'&'", + "type": "Literal", + "value": "&", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 32, + 43, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 28, + 44, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "name": "e", + "optional": false, + "range": Array [ + 51, + 52, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 59, + 76, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 62, + 76, + ], + "raw": "'id=1&group=2'", + "type": "Literal", + "value": "id=1&group=2", + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "name": "g", + "optional": false, + "range": Array [ + 80, + 81, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "method": true, + "optional": false, + "range": Array [ + 80, + 103, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "range": Array [ + 101, + 103, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "h", + "optional": false, + "range": Array [ + 82, + 83, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "optional": false, + "range": Array [ + 82, + 99, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 86, + 99, + ], + "raw": "'�'", + "type": "Literal", + "value": "�", + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 81, + 103, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "name": "i", + "optional": false, + "range": Array [ + 107, + 108, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 30, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 107, + 135, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 7, + }, + "start": Object { + "column": 28, + "line": 7, + }, + }, + "range": Array [ + 133, + 135, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 30, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "name": "j", + "optional": false, + "range": Array [ + 111, + 112, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "optional": false, + "range": Array [ + 111, + 128, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 115, + 128, + ], + "raw": "'�'", + "type": "Literal", + "value": "�", + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 110, + 135, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "range": Array [ + 55, + 138, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 51, + 138, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 2, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 45, + 139, + ], + "type": "VariableDeclaration", + }, + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 144, + 150, + ], + "raw": "'&#x;'", + "type": "Literal", + "value": "&#x;", + }, + ], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "name": "e", + "optional": false, + "range": Array [ + 140, + 141, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "name": "i", + "optional": false, + "range": Array [ + 142, + 143, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 140, + 143, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "optional": false, + "range": Array [ + 140, + 151, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 140, + 152, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 153, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "String", + "value": "' '", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "String", + "value": "' '", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 36, + 43, + ], + "type": "String", + "value": "'&'", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 45, + 50, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 62, + 76, + ], + "type": "String", + "value": "'id=1&group=2'", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Identifier", + "value": "g", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Identifier", + "value": "h", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 86, + 99, + ], + "type": "String", + "value": "'�'", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 21, + "line": 6, + }, + }, + "range": Array [ + 99, + 100, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "range": Array [ + 101, + 102, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 24, + "line": 6, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 25, + "line": 6, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Identifier", + "value": "j", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 115, + 128, + ], + "type": "String", + "value": "'�'", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 7, + }, + "start": Object { + "column": 23, + "line": 7, + }, + }, + "range": Array [ + 128, + 129, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 7, + }, + "start": Object { + "column": 25, + "line": 7, + }, + }, + "range": Array [ + 130, + 132, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 7, + }, + "start": Object { + "column": 28, + "line": 7, + }, + }, + "range": Array [ + 133, + 134, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 7, + }, + "start": Object { + "column": 29, + "line": 7, + }, + }, + "range": Array [ + 134, + 135, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 7, + }, + "start": Object { + "column": 30, + "line": 7, + }, + }, + "range": Array [ + 135, + 136, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 137, + 138, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 8, + }, + "start": Object { + "column": 1, + "line": 8, + }, + }, + "range": Array [ + 138, + 139, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 140, + 141, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 1, + "line": 9, + }, + }, + "range": Array [ + 141, + 142, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 142, + 143, + ], + "type": "Identifier", + "value": "i", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "range": Array [ + 143, + 144, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 144, + 150, + ], + "type": "String", + "value": "'&#x;'", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "start": Object { + "column": 10, + "line": 9, + }, + }, + "range": Array [ + 150, + 151, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 11, + "line": 9, + }, + }, + "range": Array [ + 151, + 152, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx-useJSXTextNode/self-closing-tag-inside-tag.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx-useJSXTextNode/self-closing-tag-inside-tag.src.js.shot new file mode 100644 index 00000000000..5abb5af0115 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx-useJSXTextNode/self-closing-tag-inside-tag.src.js.shot @@ -0,0 +1,472 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx-useJSXTextNode self-closing-tag-inside-tag.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 10, + 17, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 10, + 17, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": " +", + "type": "JSXText", + "value": " +", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "div", + "range": Array [ + 20, + 23, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 18, + 24, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 24, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "JSXText", + "value": " +", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx-useJSXTextNode/test-content.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx-useJSXTextNode/test-content.src.js.shot new file mode 100644 index 00000000000..6f5a8d10424 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx-useJSXTextNode/test-content.src.js.shot @@ -0,0 +1,318 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx-useJSXTextNode test-content.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 18, + ], + "raw": "@test content", + "type": "JSXText", + "value": "@test content", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 20, + 23, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 18, + 24, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 24, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 18, + ], + "type": "JSXText", + "value": "@test content", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/attributes.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/attributes.src.js.shot new file mode 100644 index 00000000000..241978d18f6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/attributes.src.js.shot @@ -0,0 +1,682 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx attributes.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 39, + ], + "raw": "test", + "type": "JSXText", + "value": "test", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 41, + 44, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 39, + 45, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 5, + 8, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 5, + 14, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "raw": "\\"baz\\"", + "type": "Literal", + "value": "baz", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "qux", + "range": Array [ + 15, + 18, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 15, + 24, + ], + "type": "JSXAttribute", + "value": Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "quz", + "optional": false, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "JSXExpressionContainer", + }, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "rest", + "optional": false, + "range": Array [ + 29, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 34, + ], + "type": "JSXSpreadAttribute", + }, + ], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 35, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 45, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "JSXIdentifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "JSXText", + "value": "\\"baz\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "JSXIdentifier", + "value": "qux", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + "value": "quz", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 33, + ], + "type": "Identifier", + "value": "rest", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 39, + ], + "type": "JSXText", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 44, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/element-keyword-name.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/element-keyword-name.src.js.shot new file mode 100644 index 00000000000..4df545ff5a6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/element-keyword-name.src.js.shot @@ -0,0 +1,810 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx element-keyword-name.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "object", + "range": Array [ + 11, + 17, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 10, + 20, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 10, + 20, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 20, + 25, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "abstract", + "range": Array [ + 26, + 34, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 25, + 37, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 25, + 37, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 37, + 42, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "name": "module", + "range": Array [ + 43, + 49, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 42, + 52, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 42, + 52, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 52, + 53, + ], + "raw": " +", + "type": "JSXText", + "value": " +", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "div", + "range": Array [ + 55, + 58, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 53, + 59, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 59, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 59, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 60, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + "value": "object", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 20, + 25, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 26, + 34, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 37, + 42, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 43, + 49, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "JSXText", + "value": " +", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 55, + 58, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/embedded-comment.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/embedded-comment.src.js.shot new file mode 100644 index 00000000000..da0918624ae --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/embedded-comment.src.js.shot @@ -0,0 +1,370 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx embedded-comment.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 27, + ], + "type": "JSXEmptyExpression", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 28, + ], + "type": "JSXExpressionContainer", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 30, + 31, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 28, + 32, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 3, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 32, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 27, + ], + "type": "Block", + "value": " this is a comment ", + }, + ], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/embedded-conditional.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/embedded-conditional.src.js.shot new file mode 100644 index 00000000000..ee0ecc91d1f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/embedded-conditional.src.js.shot @@ -0,0 +1,667 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx embedded-conditional.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 3, + 24, + ], + "type": "JSXAttribute", + "value": Object { + "expression": Object { + "alternate": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "d", + "range": Array [ + 19, + 20, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 18, + 23, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 18, + 23, + ], + "type": "JSXElement", + }, + "consequent": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 11, + 12, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 10, + 15, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 10, + 15, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 23, + ], + "test": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "ConditionalExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 24, + ], + "type": "JSXExpressionContainer", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 27, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 27, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "JSXIdentifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/embedded-invalid-js-identifier.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/embedded-invalid-js-identifier.src.js.shot new file mode 100644 index 00000000000..fc3cd5e29f8 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/embedded-invalid-js-identifier.src.js.shot @@ -0,0 +1,447 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx embedded-invalid-js-identifier.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [ + Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "br", + "range": Array [ + 6, + 8, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 5, + 11, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 5, + 11, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 35, + ], + "raw": "7x invalid-js-identifier", + "type": "JSXText", + "value": "7x invalid-js-identifier", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 37, + 40, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 35, + 41, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 41, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "JSXIdentifier", + "value": "br", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 35, + ], + "type": "JSXText", + "value": "7x invalid-js-identifier", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 40, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/empty-placeholder.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/empty-placeholder.src.js.shot new file mode 100644 index 00000000000..539fa714aa9 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/empty-placeholder.src.js.shot @@ -0,0 +1,351 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx empty-placeholder.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [ + Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 4, + ], + "type": "JSXEmptyExpression", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 5, + ], + "type": "JSXExpressionContainer", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 7, + 8, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 5, + 9, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 3, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 9, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-ignored.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-ignored.src.js.shot new file mode 100644 index 00000000000..fb1976cfcff --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-ignored.src.js.shot @@ -0,0 +1,1055 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx escape-patterns-ignored.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "b", + "range": Array [ + 5, + 6, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 5, + 12, + ], + "type": "JSXAttribute", + "value": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 8, + 11, + ], + "raw": "' '", + "type": "Literal", + "value": " ", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "JSXExpressionContainer", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "c", + "range": Array [ + 15, + 16, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 15, + 20, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 17, + 20, + ], + "raw": "\\" \\"", + "type": "Literal", + "value": " ", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "d", + "range": Array [ + 23, + 24, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 23, + 34, + ], + "type": "JSXAttribute", + "value": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 26, + 33, + ], + "raw": "'&'", + "type": "Literal", + "value": "&", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 25, + 34, + ], + "type": "JSXExpressionContainer", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "e", + "range": Array [ + 37, + 38, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 37, + 53, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 39, + 53, + ], + "raw": "\\"id=1&group=2\\"", + "type": "Literal", + "value": "id=1&group=2", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "name": "f", + "range": Array [ + 56, + 57, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 56, + 71, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 58, + 71, + ], + "raw": "\\"�\\"", + "type": "Literal", + "value": "�", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "name": "g", + "range": Array [ + 74, + 75, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 74, + 85, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 76, + 85, + ], + "raw": "\\"{*;\\"", + "type": "Literal", + "value": "{*;", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "name": "h", + "range": Array [ + 88, + 89, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 88, + 96, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 90, + 96, + ], + "raw": "\\"&#x;\\"", + "type": "Literal", + "value": "&#x;", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 99, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 99, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 100, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 101, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "String", + "value": "' '", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "JSXText", + "value": "\\" \\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "JSXIdentifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 26, + 33, + ], + "type": "String", + "value": "'&'", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "JSXIdentifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 39, + 53, + ], + "type": "JSXText", + "value": "\\"id=1&group=2\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "JSXIdentifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 58, + 71, + ], + "type": "JSXText", + "value": "\\"�\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "JSXIdentifier", + "value": "g", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 76, + 85, + ], + "type": "JSXText", + "value": "\\"{*;\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "JSXIdentifier", + "value": "h", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 8, + }, + "start": Object { + "column": 3, + "line": 8, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 90, + 96, + ], + "type": "JSXText", + "value": "\\"&#x;\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 9, + }, + "start": Object { + "column": 1, + "line": 9, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 99, + 100, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-unknown.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-unknown.src.js.shot new file mode 100644 index 00000000000..aeeb7caeb03 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-unknown.src.js.shot @@ -0,0 +1,1722 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx escape-patterns-unknown.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 3, + 20, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 20, + ], + "raw": "\\"¬anentity;\\"", + "type": "Literal", + "value": "¬anentity;", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 23, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 23, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "name": "b", + "range": Array [ + 28, + 29, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 28, + 36, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 30, + 36, + ], + "raw": "\\"&##;\\"", + "type": "Literal", + "value": "&##;", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "name": "b", + "range": Array [ + 26, + 27, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 25, + 39, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 25, + 39, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 25, + 40, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "name": "b", + "range": Array [ + 44, + 45, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 44, + 57, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 46, + 57, + ], + "raw": "\\"&x01FZZZ;\\"", + "type": "Literal", + "value": "&x01FZZZ;", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "name": "b", + "range": Array [ + 42, + 43, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 41, + 60, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 41, + 60, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 41, + 61, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 65, + 70, + ], + "raw": "&abc;", + "type": "JSXText", + "value": "&abc;", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "name": "c", + "range": Array [ + 72, + 73, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 70, + 74, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "name": "c", + "range": Array [ + 63, + 64, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 62, + 65, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 62, + 74, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 62, + 75, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 79, + 92, + ], + "raw": "¬anentity;", + "type": "JSXText", + "value": "¬anentity;", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "name": "d", + "range": Array [ + 94, + 95, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 92, + 96, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "name": "d", + "range": Array [ + 77, + 78, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 76, + 79, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 76, + 96, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 76, + 97, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 101, + 105, + ], + "raw": "&#x;", + "type": "JSXText", + "value": "&#x;", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "e", + "range": Array [ + 107, + 108, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 105, + 109, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "name": "e", + "range": Array [ + 99, + 100, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 98, + 101, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 98, + 109, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 98, + 110, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 111, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 20, + ], + "type": "JSXText", + "value": "\\"¬anentity;\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "JSXText", + "value": "\\"&##;\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 46, + 57, + ], + "type": "JSXText", + "value": "\\"&x01FZZZ;\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 65, + 70, + ], + "type": "JSXText", + "value": "&abc;", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "JSXIdentifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 79, + 92, + ], + "type": "JSXText", + "value": "¬anentity;", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "JSXIdentifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "range": Array [ + 99, + 100, + ], + "type": "JSXIdentifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 101, + 105, + ], + "type": "JSXText", + "value": "&#x;", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "JSXIdentifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-valid.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-valid.src.js.shot new file mode 100644 index 00000000000..cc098930c42 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/escape-patterns-valid.src.js.shot @@ -0,0 +1,541 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx escape-patterns-valid.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 34, + ], + "raw": " +   +", + "type": "JSXText", + "value": " +   +", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "a", + "range": Array [ + 36, + 37, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 34, + 38, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 3, + 12, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 12, + ], + "raw": "\\"&\\"", + "type": "Literal", + "value": "&", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 13, + 14, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 13, + 23, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 23, + ], + "raw": "\\"{\\"", + "type": "Literal", + "value": "{", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 24, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 38, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 12, + ], + "type": "JSXText", + "value": "\\"&\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 23, + ], + "type": "JSXText", + "value": "\\"{\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 34, + ], + "type": "JSXText", + "value": " +   +", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/escape-patters-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/escape-patters-multi.src.js.shot new file mode 100644 index 00000000000..cd171955f96 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/escape-patters-multi.src.js.shot @@ -0,0 +1,427 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx escape-patters-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 44, + ], + "raw": "  test", + "type": "JSXText", + "value": "  test", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 46, + 47, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 44, + 48, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "href", + "range": Array [ + 3, + 7, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 3, + 32, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 32, + ], + "raw": "\\"test=1&bar=1{\\"", + "type": "Literal", + "value": "test=1&bar=1{", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 33, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 48, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 49, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 7, + ], + "type": "JSXIdentifier", + "value": "href", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 32, + ], + "type": "JSXText", + "value": "\\"test=1&bar=1{\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 44, + ], + "type": "JSXText", + "value": "  test", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 1, + }, + "start": Object { + "column": 48, + "line": 1, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-value-with-dots.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-value-with-dots.src.js.shot new file mode 100644 index 00000000000..fd09316ce46 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/invalid-namespace-value-with-dots.src.js.shot @@ -0,0 +1,492 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx invalid-namespace-value-with-dots.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 11, + 12, + ], + "type": "JSXIdentifier", + }, + "namespace": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 9, + 12, + ], + "type": "JSXNamespacedName", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 13, + 14, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 9, + 14, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 7, + 15, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + }, + "namespace": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXNamespacedName", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 5, + 6, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 6, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 0, + 7, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 15, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "a:b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "JSXIdentifier", + "value": "a:b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/japanese-characters.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/japanese-characters.src.js.shot new file mode 100644 index 00000000000..fac1b442189 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/japanese-characters.src.js.shot @@ -0,0 +1,280 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx japanese-characters.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "日本語", + "range": Array [ + 7, + 10, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 5, + 11, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "日本語", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 11, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "日本語", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "JSXIdentifier", + "value": "日本語", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/less-than-operator.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/less-than-operator.src.js.shot new file mode 100644 index 00000000000..9a015370413 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/less-than-operator.src.js.shot @@ -0,0 +1,303 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx less-than-operator.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 2, + 5, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 8, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 1, + 8, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "<", + "range": Array [ + 0, + 13, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 5, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/member-expression-this.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/member-expression-this.src.js.shot new file mode 100644 index 00000000000..3a7e8f2e723 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/member-expression-this.src.js.shot @@ -0,0 +1,570 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx member-expression-this.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "this", + "range": Array [ + 1, + 5, + ], + "type": "JSXIdentifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "state", + "range": Array [ + 6, + 11, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 11, + ], + "type": "JSXMemberExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "Component", + "range": Array [ + 12, + 21, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 21, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 0, + 24, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 24, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "name": "this", + "range": Array [ + 27, + 31, + ], + "type": "JSXIdentifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "Component", + "range": Array [ + 32, + 41, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 27, + 41, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 26, + 44, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 26, + 44, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 26, + 45, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 46, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 5, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "JSXIdentifier", + "value": "state", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 21, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 27, + 31, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 32, + 41, + ], + "type": "JSXIdentifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/member-expression.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/member-expression.src.js.shot new file mode 100644 index 00000000000..596329f458b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/member-expression.src.js.shot @@ -0,0 +1,404 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx member-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 7, + 8, + ], + "type": "JSXIdentifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 9, + 10, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 7, + 10, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 5, + 11, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 11, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/multiple-blank-spaces.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/multiple-blank-spaces.src.js.shot new file mode 100644 index 00000000000..d7b71e4c67e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/multiple-blank-spaces.src.js.shot @@ -0,0 +1,318 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx multiple-blank-spaces.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 7, + ], + "raw": " ", + "type": "JSXText", + "value": " ", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 7, + 11, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 3, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 11, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 7, + ], + "type": "JSXText", + "value": " ", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/namespace-this-name.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/namespace-this-name.src.js.shot new file mode 100644 index 00000000000..7e0f5295c12 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/namespace-this-name.src.js.shot @@ -0,0 +1,227 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx namespace-this-name.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "bar", + "range": Array [ + 6, + 9, + ], + "type": "JSXIdentifier", + }, + "namespace": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "this", + "range": Array [ + 1, + 5, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 9, + ], + "type": "JSXNamespacedName", + }, + "range": Array [ + 0, + 12, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 12, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 9, + ], + "type": "JSXIdentifier", + "value": "this:bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/namespaced-attribute-and-value-inserted.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/namespaced-attribute-and-value-inserted.src.js.shot new file mode 100644 index 00000000000..9b4e0acdb68 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/namespaced-attribute-and-value-inserted.src.js.shot @@ -0,0 +1,938 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx namespaced-attribute-and-value-inserted.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "raw": " ", + "type": "JSXText", + "value": " ", + }, + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "value", + "optional": false, + "range": Array [ + 17, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "JSXExpressionContainer", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "raw": " ", + "type": "JSXText", + "value": " ", + }, + Object { + "children": Array [ + Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 28, + 29, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 27, + 32, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 27, + 32, + ], + "type": "JSXElement", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 34, + 35, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 32, + 36, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 25, + 26, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 24, + 27, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 24, + 36, + ], + "type": "JSXElement", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 38, + 39, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 36, + 40, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "range": Array [ + 5, + 8, + ], + "type": "JSXIdentifier", + }, + "namespace": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "n", + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 3, + 8, + ], + "type": "JSXNamespacedName", + }, + "range": Array [ + 3, + 14, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "raw": "\\"bar\\"", + "type": "Literal", + "value": "bar", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 15, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 40, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 8, + ], + "type": "JSXIdentifier", + "value": "n:foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "JSXText", + "value": "\\"bar\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "JSXText", + "value": " ", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 22, + ], + "type": "Identifier", + "value": "value", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "JSXText", + "value": " ", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/namespaced-name-and-attribute.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/namespaced-name-and-attribute.src.js.shot new file mode 100644 index 00000000000..9b209cf1633 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/namespaced-name-and-attribute.src.js.shot @@ -0,0 +1,317 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx namespaced-name-and-attribute.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "v", + "range": Array [ + 7, + 8, + ], + "type": "JSXIdentifier", + }, + "namespace": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "n", + "range": Array [ + 5, + 6, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 5, + 8, + ], + "type": "JSXNamespacedName", + }, + "range": Array [ + 5, + 8, + ], + "type": "JSXAttribute", + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + }, + "namespace": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "n", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXNamespacedName", + }, + "range": Array [ + 0, + 11, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 11, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "n:a", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "JSXIdentifier", + "value": "n:v", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/self-closing-tag-inside-tag.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/self-closing-tag-inside-tag.src.js.shot new file mode 100644 index 00000000000..921f92dc5b7 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/self-closing-tag-inside-tag.src.js.shot @@ -0,0 +1,472 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx self-closing-tag-inside-tag.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "foo", + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 10, + 17, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 10, + 17, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "raw": " +", + "type": "JSXText", + "value": " +", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "div", + "range": Array [ + 20, + 23, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 18, + 24, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 24, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "JSXIdentifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "JSXText", + "value": " +", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/self-closing-tag.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/self-closing-tag.src.js.shot new file mode 100644 index 00000000000..69decc59f4a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/self-closing-tag.src.js.shot @@ -0,0 +1,192 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx self-closing-tag.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 5, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/shorthand-fragment-with-child.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/shorthand-fragment-with-child.src.js.shot new file mode 100644 index 00000000000..83610f13eb6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/shorthand-fragment-with-child.src.js.shot @@ -0,0 +1,317 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx shorthand-fragment-with-child.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [ + Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 3, + 6, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 2, + 9, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 2, + 9, + ], + "type": "JSXElement", + }, + ], + "closingFragment": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "JSXClosingFragment", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingFragment": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 2, + ], + "type": "JSXOpeningFragment", + }, + "range": Array [ + 0, + 12, + ], + "type": "JSXFragment", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 6, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/shorthand-fragment.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/shorthand-fragment.src.js.shot new file mode 100644 index 00000000000..40eb0c61e8d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/shorthand-fragment.src.js.shot @@ -0,0 +1,187 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx shorthand-fragment.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [], + "closingFragment": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 5, + ], + "type": "JSXClosingFragment", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingFragment": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 2, + ], + "type": "JSXOpeningFragment", + }, + "range": Array [ + 0, + 5, + ], + "type": "JSXFragment", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/spread-child.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/spread-child.src.js.shot new file mode 100644 index 00000000000..9eca921ea7d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/spread-child.src.js.shot @@ -0,0 +1,426 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx spread-child.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [ + Object { + "expression": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + ], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 13, + ], + "type": "JSXSpreadChild", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 15, + 18, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 13, + 19, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 19, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/spread-operator-attribute-and-regular-attribute.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/spread-operator-attribute-and-regular-attribute.src.js.shot new file mode 100644 index 00000000000..a2d98db8d7d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/spread-operator-attribute-and-regular-attribute.src.js.shot @@ -0,0 +1,411 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx spread-operator-attribute-and-regular-attribute.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "props", + "optional": false, + "range": Array [ + 9, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 15, + ], + "type": "JSXSpreadAttribute", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "post", + "range": Array [ + 16, + 20, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 16, + 32, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 32, + ], + "raw": "\\"attribute\\"", + "type": "Literal", + "value": "attribute", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 35, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 35, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Identifier", + "value": "props", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 20, + ], + "type": "JSXIdentifier", + "value": "post", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 32, + ], + "type": "JSXText", + "value": "\\"attribute\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/spread-operator-attributes.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/spread-operator-attributes.src.js.shot new file mode 100644 index 00000000000..9f06bd404b6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/spread-operator-attributes.src.js.shot @@ -0,0 +1,303 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx spread-operator-attributes.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "props", + "optional": false, + "range": Array [ + 9, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 15, + ], + "type": "JSXSpreadAttribute", + }, + ], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 18, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 18, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Identifier", + "value": "props", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/tag-names-with-dots.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/tag-names-with-dots.src.js.shot new file mode 100644 index 00000000000..e7049389e4b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/tag-names-with-dots.src.js.shot @@ -0,0 +1,422 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx tag-names-with-dots.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 7, + 8, + ], + "type": "JSXIdentifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 9, + 10, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 7, + 10, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 5, + 11, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 11, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/tag-names-with-multi-dots-multi.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/tag-names-with-multi-dots-multi.src.js.shot new file mode 100644 index 00000000000..797219d3f6e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/tag-names-with-multi-dots-multi.src.js.shot @@ -0,0 +1,1714 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx tag-names-with-multi-dots-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "name": "this", + "range": Array [ + 45, + 49, + ], + "type": "JSXIdentifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "name": "const", + "range": Array [ + 50, + 55, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 45, + 55, + ], + "type": "JSXMemberExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "name": "declare", + "range": Array [ + 56, + 63, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 45, + 63, + ], + "type": "JSXMemberExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 2, + }, + "start": Object { + "column": 50, + "line": 2, + }, + }, + "name": "static", + "range": Array [ + 64, + 70, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 45, + 70, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 43, + 71, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "name": "this", + "range": Array [ + 17, + 21, + ], + "type": "JSXIdentifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": "const", + "range": Array [ + 22, + 27, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 17, + 27, + ], + "type": "JSXMemberExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "declare", + "range": Array [ + 28, + 35, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 17, + 35, + ], + "type": "JSXMemberExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "name": "static", + "range": Array [ + 36, + 42, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 17, + 42, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 16, + 43, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 16, + 71, + ], + "type": "JSXElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 57, + "line": 2, + }, + }, + "range": Array [ + 71, + 72, + ], + "raw": " +", + "type": "JSXText", + "value": " +", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "a", + "range": Array [ + 74, + 75, + ], + "type": "JSXIdentifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "b", + "range": Array [ + 76, + 77, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 74, + 77, + ], + "type": "JSXMemberExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "c", + "range": Array [ + 78, + 79, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 74, + 79, + ], + "type": "JSXMemberExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "d", + "range": Array [ + 80, + 81, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 74, + 81, + ], + "type": "JSXMemberExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "name": "e", + "range": Array [ + 82, + 83, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 74, + 83, + ], + "type": "JSXMemberExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "name": "f", + "range": Array [ + 84, + 85, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 74, + 85, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 72, + 86, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXMemberExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 5, + 6, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 6, + ], + "type": "JSXMemberExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "d", + "range": Array [ + 7, + 8, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 8, + ], + "type": "JSXMemberExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "e", + "range": Array [ + 9, + 10, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 10, + ], + "type": "JSXMemberExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "f", + "range": Array [ + 11, + 12, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 12, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 0, + 13, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 86, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 87, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 88, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "JSXIdentifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "JSXIdentifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "JSXIdentifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 22, + 27, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 28, + 35, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "Identifier", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 45, + 49, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 50, + 55, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "range": Array [ + 56, + 63, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 2, + }, + "start": Object { + "column": 49, + "line": 2, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 2, + }, + "start": Object { + "column": 50, + "line": 2, + }, + }, + "range": Array [ + 64, + 70, + ], + "type": "Identifier", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 56, + "line": 2, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 57, + "line": 2, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "JSXText", + "value": " +", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "JSXIdentifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "JSXIdentifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "JSXIdentifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/tag-names-with-multi-dots.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/tag-names-with-multi-dots.src.js.shot new file mode 100644 index 00000000000..8aa9f0436a7 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/tag-names-with-multi-dots.src.js.shot @@ -0,0 +1,564 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx tag-names-with-multi-dots.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 9, + 10, + ], + "type": "JSXIdentifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 11, + 12, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 9, + 12, + ], + "type": "JSXMemberExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 13, + 14, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 9, + 14, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 7, + 15, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXMemberExpression", + }, + "property": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "c", + "range": Array [ + 5, + 6, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 1, + 6, + ], + "type": "JSXMemberExpression", + }, + "range": Array [ + 0, + 7, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 15, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "JSXIdentifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "JSXIdentifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "JSXIdentifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/test-content.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/test-content.src.js.shot new file mode 100644 index 00000000000..4e1a62785cc --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/test-content.src.js.shot @@ -0,0 +1,318 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx test-content.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 18, + ], + "raw": "@test content", + "type": "JSXText", + "value": "@test content", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 20, + 23, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 18, + 24, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 5, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 24, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 18, + ], + "type": "JSXText", + "value": "@test content", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/jsx/trailing-spread-operator-attribute.src.js.shot b/packages/typescript-estree/tests/snapshots/jsx/trailing-spread-operator-attribute.src.js.shot new file mode 100644 index 00000000000..d5bb5fd7fc6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/jsx/trailing-spread-operator-attribute.src.js.shot @@ -0,0 +1,607 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`jsx trailing-spread-operator-attribute.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 49, + 52, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 47, + 53, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "pre", + "range": Array [ + 5, + 8, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 5, + 18, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 18, + ], + "raw": "\\"leading\\"", + "type": "Literal", + "value": "leading", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "pre2", + "range": Array [ + 19, + 23, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 19, + 35, + ], + "type": "JSXAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 35, + ], + "raw": "\\"attribute\\"", + "type": "Literal", + "value": "attribute", + }, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "name": "props", + "optional": false, + "range": Array [ + 40, + 45, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 46, + ], + "type": "JSXSpreadAttribute", + }, + ], + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "div", + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 47, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 0, + 53, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 54, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 54, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "JSXIdentifier", + "value": "pre", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 18, + ], + "type": "JSXText", + "value": "\\"leading\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "JSXIdentifier", + "value": "pre2", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 35, + ], + "type": "JSXText", + "value": "\\"attribute\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 40, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 45, + ], + "type": "Identifier", + "value": "props", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 1, + }, + "start": Object { + "column": 48, + "line": 1, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 52, + ], + "type": "JSXIdentifier", + "value": "div", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 52, + "line": 1, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 53, + "line": 1, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/tsx/generic-jsx-element.src.tsx.shot b/packages/typescript-estree/tests/snapshots/tsx/generic-jsx-element.src.tsx.shot new file mode 100644 index 00000000000..acc324cfad1 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/tsx/generic-jsx-element.src.tsx.shot @@ -0,0 +1,425 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`tsx generic-jsx-element.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [], + "closingElement": null, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "data", + "range": Array [ + 21, + 25, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 21, + 30, + ], + "type": "JSXAttribute", + "value": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 29, + ], + "raw": "12", + "type": "Literal", + "value": 12, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 30, + ], + "type": "JSXExpressionContainer", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "MyComponent", + "range": Array [ + 1, + 12, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 33, + ], + "selfClosing": true, + "type": "JSXOpeningElement", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 19, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 12, + 20, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "range": Array [ + 0, + 33, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 12, + ], + "type": "JSXIdentifier", + "value": "MyComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 19, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 25, + ], + "type": "JSXIdentifier", + "value": "data", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 29, + ], + "type": "Numeric", + "value": "12", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/tsx/generic-jsx-opening-element.src.tsx.shot b/packages/typescript-estree/tests/snapshots/tsx/generic-jsx-opening-element.src.tsx.shot new file mode 100644 index 00000000000..d38d0c85cd3 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/tsx/generic-jsx-opening-element.src.tsx.shot @@ -0,0 +1,513 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`tsx generic-jsx-opening-element.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "children": Array [], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "name": "MyComponent", + "range": Array [ + 33, + 44, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 31, + 45, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "openingElement": Object { + "attributes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "data", + "range": Array [ + 21, + 25, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 21, + 30, + ], + "type": "JSXAttribute", + "value": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 29, + ], + "raw": "12", + "type": "Literal", + "value": 12, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 30, + ], + "type": "JSXExpressionContainer", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "MyComponent", + "range": Array [ + 1, + 12, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 0, + 31, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 19, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 12, + 20, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "range": Array [ + 0, + 45, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 46, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 12, + ], + "type": "JSXIdentifier", + "value": "MyComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 19, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 25, + ], + "type": "JSXIdentifier", + "value": "data", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 29, + ], + "type": "Numeric", + "value": "12", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 44, + ], + "type": "JSXIdentifier", + "value": "MyComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/tsx/react-typed-props.src.tsx.shot b/packages/typescript-estree/tests/snapshots/tsx/react-typed-props.src.tsx.shot new file mode 100644 index 00000000000..ba034cff116 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/tsx/react-typed-props.src.tsx.shot @@ -0,0 +1,1389 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`tsx react-typed-props.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "value", + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 30, + ], + "raw": "'react'", + "type": "Literal", + "value": "react", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "React", + "optional": false, + "range": Array [ + 12, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 7, + 17, + ], + "type": "ImportNamespaceSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "Props", + "optional": false, + "range": Array [ + 36, + 41, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 31, + 63, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "members": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "title", + "optional": false, + "range": Array [ + 48, + 53, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "range": Array [ + 48, + 61, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 53, + 61, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 55, + 61, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 44, + 63, + ], + "type": "TSTypeLiteral", + }, + "typeParameters": undefined, + }, + Object { + "declaration": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "children": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 128, + 135, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 7, + "line": 9, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 7, + "line": 9, + }, + }, + "name": "props", + "optional": false, + "range": Array [ + 136, + 141, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 13, + "line": 9, + }, + }, + "name": "title", + "optional": false, + "range": Array [ + 142, + 147, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 136, + 147, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 9, + }, + }, + "range": Array [ + 135, + 148, + ], + "type": "JSXExpressionContainer", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 10, + }, + "start": Object { + "column": 19, + "line": 9, + }, + }, + "range": Array [ + 148, + 153, + ], + "raw": " + ", + "type": "JSXText", + "value": " + ", + }, + ], + "closingElement": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 10, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 10, + }, + "start": Object { + "column": 6, + "line": 10, + }, + }, + "name": "h1", + "range": Array [ + 155, + 157, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 153, + 158, + ], + "type": "JSXClosingElement", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "openingElement": Object { + "attributes": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 5, + "line": 8, + }, + }, + "name": "h1", + "range": Array [ + 125, + 127, + ], + "type": "JSXIdentifier", + }, + "range": Array [ + 124, + 128, + ], + "selfClosing": false, + "type": "JSXOpeningElement", + "typeParameters": undefined, + }, + "range": Array [ + 124, + 158, + ], + "type": "JSXElement", + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 111, + 162, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 42, + "line": 6, + }, + }, + "range": Array [ + 107, + 164, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 6, + }, + "start": Object { + "column": 24, + "line": 6, + }, + }, + "name": "App", + "optional": false, + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 15, + "line": 6, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 40, + "line": 6, + }, + "start": Object { + "column": 28, + "line": 6, + }, + }, + "name": "props", + "optional": false, + "range": Array [ + 93, + 105, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 6, + }, + "start": Object { + "column": 33, + "line": 6, + }, + }, + "range": Array [ + 98, + 105, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 6, + }, + "start": Object { + "column": 35, + "line": 6, + }, + }, + "range": Array [ + 100, + 105, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 40, + "line": 6, + }, + "start": Object { + "column": 35, + "line": 6, + }, + }, + "name": "Props", + "optional": false, + "range": Array [ + 100, + 105, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 80, + 164, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 65, + 164, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 164, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 17, + ], + "type": "Identifier", + "value": "React", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 22, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 30, + ], + "type": "String", + "value": "'react'", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 31, + 35, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 36, + 41, + ], + "type": "Identifier", + "value": "Props", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 48, + 53, + ], + "type": "Identifier", + "value": "title", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 55, + 61, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 65, + 71, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 72, + 79, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 15, + "line": 6, + }, + }, + "range": Array [ + 80, + 88, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 6, + }, + "start": Object { + "column": 24, + "line": 6, + }, + }, + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + "value": "App", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 6, + }, + "start": Object { + "column": 27, + "line": 6, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 6, + }, + "start": Object { + "column": 28, + "line": 6, + }, + }, + "range": Array [ + 93, + 98, + ], + "type": "Identifier", + "value": "props", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 6, + }, + "start": Object { + "column": 33, + "line": 6, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 6, + }, + "start": Object { + "column": 35, + "line": 6, + }, + }, + "range": Array [ + 100, + 105, + ], + "type": "Identifier", + "value": "Props", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 6, + }, + "start": Object { + "column": 40, + "line": 6, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 6, + }, + "start": Object { + "column": 42, + "line": 6, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 111, + 117, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "range": Array [ + 118, + 119, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 5, + "line": 8, + }, + }, + "range": Array [ + 125, + 127, + ], + "type": "JSXIdentifier", + "value": "h1", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 127, + 128, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 128, + 135, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 9, + }, + }, + "range": Array [ + 135, + 136, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 7, + "line": 9, + }, + }, + "range": Array [ + 136, + 141, + ], + "type": "JSXIdentifier", + "value": "props", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "range": Array [ + 141, + 142, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 13, + "line": 9, + }, + }, + "range": Array [ + 142, + 147, + ], + "type": "JSXIdentifier", + "value": "title", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 18, + "line": 9, + }, + }, + "range": Array [ + 147, + 148, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 10, + }, + "start": Object { + "column": 19, + "line": 9, + }, + }, + "range": Array [ + 148, + 153, + ], + "type": "JSXText", + "value": " + ", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 10, + }, + }, + "range": Array [ + 153, + 154, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 10, + }, + "start": Object { + "column": 5, + "line": 10, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Punctuator", + "value": "/", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 10, + }, + "start": Object { + "column": 6, + "line": 10, + }, + }, + "range": Array [ + 155, + 157, + ], + "type": "JSXIdentifier", + "value": "h1", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "range": Array [ + 157, + 158, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "range": Array [ + 161, + 162, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 12, + }, + }, + "range": Array [ + 163, + 164, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/babylon-convergence/type-parameter-whitespace-loc.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/babylon-convergence/type-parameter-whitespace-loc.src.ts.shot new file mode 100644 index 00000000000..5ee9949c8b7 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/babylon-convergence/type-parameter-whitespace-loc.src.ts.shot @@ -0,0 +1,312 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript babylon-convergence type-parameter-whitespace-loc.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 24, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 13, + 14, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 10, + 19, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/babylon-convergence/type-parameters.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/babylon-convergence/type-parameters.src.ts.shot new file mode 100644 index 00000000000..370cfc2ff60 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/babylon-convergence/type-parameters.src.ts.shot @@ -0,0 +1,416 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript babylon-convergence type-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 42, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 42, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "TSObjectKeyword", + }, + "default": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "TSObjectKeyword", + }, + "in": false, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 11, + 36, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 10, + 37, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 20, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "Identifier", + "value": "object", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "Identifier", + "value": "object", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-constructor.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-constructor.src.ts.shot new file mode 100644 index 00000000000..c859e255d4b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-constructor.src.ts.shot @@ -0,0 +1,382 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics abstract-class-with-abstract-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "abstract": true, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 52, + 63, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 43, + 66, + ], + "static": false, + "type": "TSAbstractMethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": null, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 63, + 66, + ], + "returnType": undefined, + "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 68, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "AbstractSocket", + "optional": false, + "range": Array [ + 22, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 68, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 68, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 68, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 36, + ], + "type": "Identifier", + "value": "AbstractSocket", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 43, + 51, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 52, + 63, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-method.src.ts.shot new file mode 100644 index 00000000000..e800d9256e1 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-method.src.ts.shot @@ -0,0 +1,562 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics abstract-class-with-abstract-method.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "abstract": true, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "createSocket", + "optional": false, + "range": Array [ + 52, + 64, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 43, + 84, + ], + "static": false, + "type": "TSAbstractMethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": null, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 64, + 84, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 66, + 83, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 68, + 83, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "name": "Promise", + "optional": false, + "range": Array [ + 68, + 75, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "TSStringKeyword", + }, + ], + "range": Array [ + 75, + 83, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 86, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "AbstractSocket", + "optional": false, + "range": Array [ + 22, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 86, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 86, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 86, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 36, + ], + "type": "Identifier", + "value": "AbstractSocket", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 43, + 51, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 52, + 64, + ], + "type": "Identifier", + "value": "createSocket", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 68, + 75, + ], + "type": "Identifier", + "value": "Promise", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-properties.src.ts.shot new file mode 100644 index 00000000000..e9b5b3aaf8d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-properties.src.ts.shot @@ -0,0 +1,456 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics abstract-class-with-abstract-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": true, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 25, + 38, + ], + "readonly": false, + "static": false, + "type": "TSAbstractPropertyDefinition", + "typeAnnotation": undefined, + "value": null, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 43, + 64, + ], + "readonly": false, + "static": false, + "type": "TSAbstractPropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 55, + 63, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 57, + 63, + ], + "type": "TSNumberKeyword", + }, + }, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 66, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 66, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 67, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 25, + 33, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 43, + 51, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 57, + 63, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-readonly-property.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-readonly-property.src.ts.shot new file mode 100644 index 00000000000..60776d29fa3 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-readonly-property.src.ts.shot @@ -0,0 +1,389 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics abstract-class-with-abstract-readonly-property.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": true, + "body": Object { + "body": Array [ + Object { + "accessibility": "public", + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 48, + 51, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 23, + 60, + ], + "readonly": true, + "static": false, + "type": "TSAbstractPropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 51, + 59, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 62, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 62, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 63, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 30, + 38, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 39, + 47, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 48, + 51, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-static-constructor.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-static-constructor.src.ts.shot new file mode 100644 index 00000000000..503adfa42c7 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-abstract-static-constructor.src.ts.shot @@ -0,0 +1,400 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics abstract-class-with-abstract-static-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "abstract": true, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 57, + 68, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 41, + 71, + ], + "static": true, + "type": "TSAbstractMethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": null, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 68, + 71, + ], + "returnType": undefined, + "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 73, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "AbstractSocket", + "optional": false, + "range": Array [ + 22, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 73, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 73, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 74, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 36, + ], + "type": "Identifier", + "value": "AbstractSocket", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 41, + 49, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 50, + 56, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 57, + 68, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-declare-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-declare-properties.src.ts.shot new file mode 100644 index 00000000000..fa5364f6d5c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-declare-properties.src.ts.shot @@ -0,0 +1,1185 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics abstract-class-with-declare-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": true, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "declare": true, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "prop1", + "optional": false, + "range": Array [ + 45, + 50, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 37, + 59, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 50, + 58, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 52, + 58, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": true, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "name": "prop2", + "optional": false, + "range": Array [ + 79, + 84, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 62, + 93, + ], + "readonly": false, + "static": false, + "type": "TSAbstractPropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 84, + 92, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 86, + 92, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "declare": true, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "name": "prop3", + "optional": false, + "range": Array [ + 120, + 125, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 96, + 134, + ], + "readonly": false, + "static": false, + "type": "TSAbstractPropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 4, + }, + "start": Object { + "column": 31, + "line": 4, + }, + }, + "range": Array [ + 125, + 133, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 4, + }, + "start": Object { + "column": 33, + "line": 4, + }, + }, + "range": Array [ + 127, + 133, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": true, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 5, + }, + "start": Object { + "column": 28, + "line": 5, + }, + }, + "name": "prop4", + "optional": false, + "range": Array [ + 163, + 168, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 137, + 177, + ], + "readonly": true, + "static": false, + "type": "TSAbstractPropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 5, + }, + "start": Object { + "column": 33, + "line": 5, + }, + }, + "range": Array [ + 168, + 176, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 5, + }, + "start": Object { + "column": 35, + "line": 5, + }, + }, + "range": Array [ + 170, + 176, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "declare": true, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 40, + "line": 6, + }, + "start": Object { + "column": 35, + "line": 6, + }, + }, + "name": "prop5", + "optional": false, + "range": Array [ + 213, + 218, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 49, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 180, + 227, + ], + "readonly": true, + "static": false, + "type": "TSAbstractPropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 6, + }, + "start": Object { + "column": 40, + "line": 6, + }, + }, + "range": Array [ + 218, + 226, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 6, + }, + "start": Object { + "column": 42, + "line": 6, + }, + }, + "range": Array [ + 220, + 226, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 229, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "AbstractDeclProps", + "optional": false, + "range": Array [ + 15, + 32, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 229, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 230, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 32, + ], + "type": "Identifier", + "value": "AbstractDeclProps", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 37, + 44, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 45, + 50, + ], + "type": "Identifier", + "value": "prop1", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 52, + 58, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 62, + 69, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 70, + 78, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 79, + 84, + ], + "type": "Identifier", + "value": "prop2", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 86, + 92, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 32, + "line": 3, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 96, + 103, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 104, + 110, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 111, + 119, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "range": Array [ + 120, + 125, + ], + "type": "Identifier", + "value": "prop3", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 31, + "line": 4, + }, + }, + "range": Array [ + 125, + 126, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 4, + }, + "start": Object { + "column": 33, + "line": 4, + }, + }, + "range": Array [ + 127, + 133, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 39, + "line": 4, + }, + }, + "range": Array [ + 133, + 134, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 137, + 144, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 145, + 153, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 154, + 162, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 5, + }, + "start": Object { + "column": 28, + "line": 5, + }, + }, + "range": Array [ + 163, + 168, + ], + "type": "Identifier", + "value": "prop4", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 5, + }, + "start": Object { + "column": 33, + "line": 5, + }, + }, + "range": Array [ + 168, + 169, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 5, + }, + "start": Object { + "column": 35, + "line": 5, + }, + }, + "range": Array [ + 170, + 176, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 5, + }, + "start": Object { + "column": 41, + "line": 5, + }, + }, + "range": Array [ + 176, + 177, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 180, + 187, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 188, + 194, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 195, + 203, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 6, + }, + "start": Object { + "column": 26, + "line": 6, + }, + }, + "range": Array [ + 204, + 212, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 6, + }, + "start": Object { + "column": 35, + "line": 6, + }, + }, + "range": Array [ + 213, + 218, + ], + "type": "Identifier", + "value": "prop5", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 6, + }, + "start": Object { + "column": 40, + "line": 6, + }, + }, + "range": Array [ + 218, + 219, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 6, + }, + "start": Object { + "column": 42, + "line": 6, + }, + }, + "range": Array [ + 220, + 226, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 6, + }, + "start": Object { + "column": 48, + "line": 6, + }, + }, + "range": Array [ + 226, + 227, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 228, + 229, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-optional-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-optional-method.src.ts.shot new file mode 100644 index 00000000000..2bc82c310bb --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-optional-method.src.ts.shot @@ -0,0 +1,562 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics abstract-class-with-optional-method.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "abstract": true, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "createSocket", + "optional": false, + "range": Array [ + 43, + 55, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 43, + 76, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": null, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 56, + 76, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 58, + 75, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 60, + 75, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "name": "Promise", + "optional": false, + "range": Array [ + 60, + 67, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "TSStringKeyword", + }, + ], + "range": Array [ + 67, + 75, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 78, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "AbstractSocket", + "optional": false, + "range": Array [ + 22, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 78, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 78, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 78, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 36, + ], + "type": "Identifier", + "value": "AbstractSocket", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 43, + 55, + ], + "type": "Identifier", + "value": "createSocket", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 60, + 67, + ], + "type": "Identifier", + "value": "Promise", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-override-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-override-method.src.ts.shot new file mode 100644 index 00000000000..2bedfb7ac5f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-override-method.src.ts.shot @@ -0,0 +1,417 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics abstract-class-with-override-method.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": true, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "name": "show", + "optional": false, + "range": Array [ + 80, + 84, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": true, + "range": Array [ + 62, + 87, + ], + "static": false, + "type": "TSAbstractMethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": null, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 84, + 87, + ], + "returnType": undefined, + "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 58, + "line": 1, + }, + }, + "range": Array [ + 58, + 89, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "SpecializedComponent", + "optional": false, + "range": Array [ + 15, + 35, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 89, + ], + "superClass": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 57, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "name": "SomeComponent", + "optional": false, + "range": Array [ + 44, + 57, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 90, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 35, + ], + "type": "Identifier", + "value": "SpecializedComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 43, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 57, + ], + "type": "Identifier", + "value": "SomeComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 1, + }, + "start": Object { + "column": 58, + "line": 1, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 62, + 70, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 71, + 79, + ], + "type": "Identifier", + "value": "override", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 80, + 84, + ], + "type": "Identifier", + "value": "show", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-override-property.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-override-property.src.ts.shot new file mode 100644 index 00000000000..1b092c20049 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-class-with-override-property.src.ts.shot @@ -0,0 +1,394 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics abstract-class-with-override-property.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": true, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 80, + 83, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": true, + "range": Array [ + 62, + 88, + ], + "readonly": false, + "static": false, + "type": "TSAbstractPropertyDefinition", + "typeAnnotation": undefined, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 58, + "line": 1, + }, + }, + "range": Array [ + 58, + 90, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "SpecializedComponent", + "optional": false, + "range": Array [ + 15, + 35, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 90, + ], + "superClass": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 57, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "name": "SomeComponent", + "optional": false, + "range": Array [ + 44, + 57, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 91, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 35, + ], + "type": "Identifier", + "value": "SpecializedComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 43, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 57, + ], + "type": "Identifier", + "value": "SomeComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 1, + }, + "start": Object { + "column": 58, + "line": 1, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 62, + 70, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 71, + 79, + ], + "type": "Identifier", + "value": "override", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 80, + 83, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 87, + 88, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-interface.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-interface.src.ts.shot new file mode 100644 index 00000000000..ead501da961 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/abstract-interface.src.ts.shot @@ -0,0 +1,215 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics abstract-interface.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "I", + "optional": false, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 31, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + "exportKind": "type", + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 25, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "I", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/angle-bracket-type-assertion-arrow-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/angle-bracket-type-assertion-arrow-function.src.ts.shot new file mode 100644 index 00000000000..8d450898f1b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/angle-bracket-type-assertion-arrow-function.src.ts.shot @@ -0,0 +1,548 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics angle-bracket-type-assertion-arrow-function.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "asserted2", + "optional": false, + "range": Array [ + 4, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "name": "n", + "optional": false, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 40, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 42, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "n", + "optional": false, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 22, + 42, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 43, + ], + "type": "TSTypeAssertion", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "TSAnyKeyword", + }, + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 43, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 13, + ], + "type": "Identifier", + "value": "asserted2", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "n", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "value": "n", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/angle-bracket-type-assertion.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/angle-bracket-type-assertion.src.ts.shot new file mode 100644 index 00000000000..1629da85325 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/angle-bracket-type-assertion.src.ts.shot @@ -0,0 +1,284 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics angle-bracket-type-assertion.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 27, + ], + "type": "TSTypeAssertion", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "TSAnyKeyword", + }, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 27, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/arrow-function-with-optional-parameter.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/arrow-function-with-optional-parameter.src.ts.shot new file mode 100644 index 00000000000..e13f20e8452 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/arrow-function-with-optional-parameter.src.ts.shot @@ -0,0 +1,403 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics arrow-function-with-optional-parameter.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "async": false, + "body": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "k", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "operator": "+", + "range": Array [ + 9, + 14, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "BinaryExpression", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "k", + "optional": true, + "range": Array [ + 2, + 4, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 1, + 14, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 17, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "k", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "k", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/arrow-function-with-type-parameters.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/arrow-function-with-type-parameters.src.ts.shot new file mode 100644 index 00000000000..d184debdce5 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/arrow-function-with-type-parameters.src.ts.shot @@ -0,0 +1,606 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics arrow-function-with-type-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 31, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 33, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 4, + 8, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 0, + 33, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "type": "ArrowFunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 1, + 2, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 0, + 3, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/async-function-expression.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/async-function-expression.src.ts.shot new file mode 100644 index 00000000000..028c4f3ca9e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/async-function-expression.src.ts.shot @@ -0,0 +1,344 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics async-function-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "async": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "test", + "optional": false, + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 1, + 26, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 29, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 6, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/async-function-with-var-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/async-function-with-var-declaration.src.ts.shot new file mode 100644 index 00000000000..ad8b2ec9dee --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/async-function-with-var-declaration.src.ts.shot @@ -0,0 +1,724 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics async-function-with-var-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "async": true, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 38, + 43, + ], + "raw": "'foo'", + "type": "Literal", + "value": "foo", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 32, + 43, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 28, + 44, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 59, + 64, + ], + "raw": "'bar'", + "type": "Literal", + "value": "bar", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 53, + 64, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 49, + 65, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "name": "fooBar", + "optional": false, + "range": Array [ + 76, + 82, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 85, + 93, + ], + "raw": "'fooBar'", + "type": "Literal", + "value": "fooBar", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 76, + 93, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 70, + 94, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 96, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "test", + "optional": false, + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 96, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 97, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 38, + 43, + ], + "type": "String", + "value": "'foo'", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 49, + 52, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 59, + 64, + ], + "type": "String", + "value": "'bar'", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 70, + 75, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "Identifier", + "value": "fooBar", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 85, + 93, + ], + "type": "String", + "value": "'fooBar'", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/await-without-async-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/await-without-async-function.src.ts.shot new file mode 100644 index 00000000000..72c8450e1e1 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/await-without-async-function.src.ts.shot @@ -0,0 +1,629 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics await-without-async-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "argument": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 37, + 40, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 37, + 42, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 31, + 42, + ], + "type": "AwaitExpression", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 25, + 42, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 19, + 43, + ], + "type": "VariableDeclaration", + }, + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "qux", + "optional": false, + "range": Array [ + 57, + 60, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 53, + 60, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 46, + 61, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 63, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 63, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 64, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 31, + 36, + ], + "type": "Identifier", + "value": "await", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 37, + 40, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 57, + 60, + ], + "type": "Identifier", + "value": "qux", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/call-signatures-with-generics.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/call-signatures-with-generics.src.ts.shot new file mode 100644 index 00000000000..9f15fc12159 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/call-signatures-with-generics.src.ts.shot @@ -0,0 +1,890 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics call-signatures-with-generics.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 67, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "members": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 19, + 28, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 20, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 15, + 37, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 29, + 37, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TSStringKeyword", + }, + }, + "type": "TSCallSignatureDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 16, + 17, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 15, + 18, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 47, + 56, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 48, + 56, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 50, + 56, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 40, + 65, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 57, + 65, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 59, + 65, + ], + "type": "TSStringKeyword", + }, + }, + "type": "TSConstructSignatureDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 44, + 45, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 43, + 46, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "range": Array [ + 11, + 67, + ], + "type": "TSTypeLiteral", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 68, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 40, + 43, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 50, + 56, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 59, + 65, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/call-signatures.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/call-signatures.src.ts.shot new file mode 100644 index 00000000000..5d82d07709b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/call-signatures.src.ts.shot @@ -0,0 +1,662 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics call-signatures.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 61, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "members": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 16, + 25, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 25, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 15, + 34, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 26, + 34, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 28, + 34, + ], + "type": "TSStringKeyword", + }, + }, + "type": "TSCallSignatureDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 41, + 50, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 42, + 50, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 44, + 50, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 37, + 59, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 51, + 59, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "TSStringKeyword", + }, + }, + "type": "TSConstructSignatureDeclaration", + "typeParameters": undefined, + }, + ], + "range": Array [ + 11, + 61, + ], + "type": "TSTypeLiteral", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 62, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 28, + 34, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 37, + 40, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 44, + 50, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-expression.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-expression.src.ts.shot new file mode 100644 index 00000000000..831a51bb958 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-expression.src.ts.shot @@ -0,0 +1,247 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics cast-as-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "<", + "range": Array [ + 0, + 5, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "TSAsExpression", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 16, + ], + "type": "TSBooleanKeyword", + }, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 8, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 16, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-multi-assign.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-multi-assign.src.ts.shot new file mode 100644 index 00000000000..239d6837284 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-multi-assign.src.ts.shot @@ -0,0 +1,351 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics cast-as-multi-assign.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "expression": Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 12, + ], + "type": "TSAsExpression", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 12, + ], + "type": "TSNumberKeyword", + }, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 19, + ], + "type": "TSAsExpression", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "TSAnyKeyword", + }, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 0, + 25, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 5, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 12, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-multi.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-multi.src.ts.shot new file mode 100644 index 00000000000..073977b60c6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-multi.src.ts.shot @@ -0,0 +1,264 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics cast-as-multi.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "TSAsExpression", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "TSAnyKeyword", + }, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "TSAsExpression", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 4, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-operator.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-operator.src.ts.shot new file mode 100644 index 00000000000..a6ad519b22a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-operator.src.ts.shot @@ -0,0 +1,245 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics cast-as-operator.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "===", + "range": Array [ + 0, + 17, + ], + "right": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 17, + ], + "type": "TSAsExpression", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 5, + ], + "type": "Punctuator", + "value": "===", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 10, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-simple.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-simple.src.ts.shot new file mode 100644 index 00000000000..999ba3023f5 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/cast-as-simple.src.ts.shot @@ -0,0 +1,268 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics cast-as-simple.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 20, + ], + "type": "TSAsExpression", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "TSAnyKeyword", + }, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 20, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/catch-clause-with-annotation.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/catch-clause-with-annotation.src.ts.shot new file mode 100644 index 00000000000..271f190c206 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/catch-clause-with-annotation.src.ts.shot @@ -0,0 +1,673 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics catch-clause-with-annotation.src 1`] = ` +Object { + "body": Array [ + Object { + "block": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 8, + ], + "type": "BlockStatement", + }, + "finalizer": null, + "handler": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 24, + 28, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "param": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "e", + "optional": false, + "range": Array [ + 16, + 22, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 17, + 22, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "TSAnyKeyword", + }, + }, + }, + "range": Array [ + 9, + 28, + ], + "type": "CatchClause", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "TryStatement", + }, + Object { + "block": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 34, + 38, + ], + "type": "BlockStatement", + }, + "finalizer": null, + "handler": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 11, + }, + "start": Object { + "column": 21, + "line": 9, + }, + }, + "range": Array [ + 58, + 62, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "param": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 9, + "line": 9, + }, + }, + "name": "e", + "optional": false, + "range": Array [ + 46, + 56, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 10, + "line": 9, + }, + }, + "range": Array [ + 47, + 56, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "range": Array [ + 49, + 56, + ], + "type": "TSUnknownKeyword", + }, + }, + }, + "range": Array [ + 39, + 62, + ], + "type": "CatchClause", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 11, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 30, + 62, + ], + "type": "TryStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 63, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "try", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Keyword", + "value": "catch", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 30, + 33, + ], + "type": "Keyword", + "value": "try", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 39, + 44, + ], + "type": "Keyword", + "value": "catch", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 9, + "line": 9, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "start": Object { + "column": 10, + "line": 9, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "range": Array [ + 49, + 56, + ], + "type": "Identifier", + "value": "unknown", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 9, + }, + "start": Object { + "column": 19, + "line": 9, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 9, + }, + "start": Object { + "column": 21, + "line": 9, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 11, + }, + "start": Object { + "column": 0, + "line": 11, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/catch-clause-with-invalid-annotation.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/catch-clause-with-invalid-annotation.src.ts.shot new file mode 100644 index 00000000000..873e5d58ec4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/catch-clause-with-invalid-annotation.src.ts.shot @@ -0,0 +1,350 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics catch-clause-with-invalid-annotation.src 1`] = ` +Object { + "body": Array [ + Object { + "block": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 8, + ], + "type": "BlockStatement", + }, + "finalizer": null, + "handler": Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 27, + 31, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "param": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "e", + "optional": false, + "range": Array [ + 16, + 25, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 17, + 25, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 9, + 31, + ], + "type": "CatchClause", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "TryStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "try", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Keyword", + "value": "catch", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-multi-line-keyword-abstract.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-multi-line-keyword-abstract.src.ts.shot new file mode 100644 index 00000000000..92999b2ef5b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-multi-line-keyword-abstract.src.ts.shot @@ -0,0 +1,219 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-multi-line-keyword-abstract.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "abstract", + "optional": false, + "range": Array [ + 0, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "ExpressionStatement", + }, + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 17, + 19, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "B", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 9, + 19, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-multi-line-keyword-declare.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-multi-line-keyword-declare.src.ts.shot new file mode 100644 index 00000000000..e7044c2559d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-multi-line-keyword-declare.src.ts.shot @@ -0,0 +1,219 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-multi-line-keyword-declare.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "declare", + "optional": false, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "ExpressionStatement", + }, + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "B", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 8, + 18, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 8, + 13, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-field-with-accessibility-error.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-field-with-accessibility-error.src.ts.shot new file mode 100644 index 00000000000..9dff921bdb2 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-field-with-accessibility-error.src.ts.shot @@ -0,0 +1,616 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-private-identifier-field-with-accessibility-error.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": "private", + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "priv1", + "range": Array [ + 22, + 28, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 36, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 36, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "priv2", + "range": Array [ + 46, + 52, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 39, + 60, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 52, + 60, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 54, + 60, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "name": "priv3", + "range": Array [ + 70, + 76, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 63, + 84, + ], + "readonly": false, + "static": true, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 76, + 84, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 78, + 84, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 86, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 86, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 87, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + "value": "#priv1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 39, + 45, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "Identifier", + "value": "#priv2", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 54, + 60, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 63, + 69, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 70, + 76, + ], + "type": "Identifier", + "value": "#priv3", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 78, + 84, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-field-with-annotation.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-field-with-annotation.src.ts.shot new file mode 100644 index 00000000000..07b5c0884e1 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-field-with-annotation.src.ts.shot @@ -0,0 +1,916 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-private-identifier-field-with-annotation.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "priv1", + "range": Array [ + 14, + 20, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 29, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSNumberKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "priv2", + "range": Array [ + 32, + 38, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 32, + 51, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 38, + 46, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "TSNumberKeyword", + }, + }, + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 55, + 66, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 55, + 95, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "priv1", + "range": Array [ + 80, + 86, + ], + "type": "PrivateIdentifier", + }, + "range": Array [ + 75, + 86, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "operator": "=", + "range": Array [ + 75, + 90, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 89, + 90, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 75, + 91, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 69, + 95, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "params": Array [], + "range": Array [ + 66, + 95, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 97, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 97, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 98, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + "value": "#priv1", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Identifier", + "value": "#priv2", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 55, + 66, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 80, + 86, + ], + "type": "Identifier", + "value": "#priv1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 87, + 88, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-readonly-field.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-readonly-field.src.ts.shot new file mode 100644 index 00000000000..11091507b80 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-private-identifier-readonly-field.src.ts.shot @@ -0,0 +1,314 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-private-identifier-readonly-field.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "priv", + "range": Array [ + 23, + 28, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 36, + ], + "readonly": true, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 36, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 38, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 22, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 23, + 28, + ], + "type": "Identifier", + "value": "#priv", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-static-blocks.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-static-blocks.src.ts.shot new file mode 100644 index 00000000000..e0feb16115b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-static-blocks.src.ts.shot @@ -0,0 +1,727 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-static-blocks.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "count", + "optional": false, + "range": Array [ + 21, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 31, + ], + "readonly": false, + "static": true, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + }, + Object { + "body": Array [ + Object { + "alternate": null, + "consequent": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": "count", + "optional": false, + "range": Array [ + 76, + 81, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "operator": "++", + "prefix": false, + "range": Array [ + 76, + 83, + ], + "type": "UpdateExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 76, + 84, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 68, + 90, + ], + "type": "BlockStatement", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 47, + 90, + ], + "test": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "name": "someCondition", + "optional": false, + "range": Array [ + 51, + 64, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 51, + 66, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "type": "IfStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 34, + 94, + ], + "type": "StaticBlock", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 96, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 96, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 97, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 26, + ], + "type": "Identifier", + "value": "count", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 47, + 49, + ], + "type": "Keyword", + "value": "if", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 51, + 64, + ], + "type": "Identifier", + "value": "someCondition", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 4, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 76, + 81, + ], + "type": "Identifier", + "value": "count", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 81, + 83, + ], + "type": "Punctuator", + "value": "++", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-accessibility-modifiers.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-accessibility-modifiers.src.ts.shot new file mode 100644 index 00000000000..66b705fe68d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-accessibility-modifiers.src.ts.shot @@ -0,0 +1,1416 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-accessibility-modifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": "private", + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 35, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 26, + 34, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 34, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 38, + 65, + ], + "readonly": false, + "static": true, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 56, + 64, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "TSNumberKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "name": "getBar", + "optional": false, + "range": Array [ + 75, + 81, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 68, + 111, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 98, + 102, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 103, + 106, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 98, + 106, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 91, + 107, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 85, + 111, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "params": Array [], + "range": Array [ + 82, + 111, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": "protected", + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "name": "setBar", + "optional": false, + "range": Array [ + 124, + 130, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 114, + 171, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 152, + 156, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 157, + 160, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 152, + 160, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "operator": "=", + "range": Array [ + 152, + 166, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 163, + 166, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 152, + 167, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 34, + "line": 7, + }, + }, + "range": Array [ + 146, + 171, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 19, + "line": 7, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 132, + 144, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 7, + }, + "start": Object { + "column": 24, + "line": 7, + }, + }, + "range": Array [ + 136, + 144, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 7, + }, + "start": Object { + "column": 26, + "line": 7, + }, + }, + "range": Array [ + 138, + 144, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 131, + 171, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 173, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 173, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 11, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 174, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 34, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 45, + 51, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 75, + 81, + ], + "type": "Identifier", + "value": "getBar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 91, + 97, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 98, + 102, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 103, + 106, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 114, + 123, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 124, + 130, + ], + "type": "Identifier", + "value": "setBar", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 7, + }, + "start": Object { + "column": 19, + "line": 7, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 132, + 135, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 7, + }, + "start": Object { + "column": 24, + "line": 7, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 7, + }, + "start": Object { + "column": 26, + "line": 7, + }, + }, + "range": Array [ + 138, + 144, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 7, + }, + "start": Object { + "column": 32, + "line": 7, + }, + }, + "range": Array [ + 144, + 145, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 7, + }, + "start": Object { + "column": 34, + "line": 7, + }, + }, + "range": Array [ + 146, + 147, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 152, + 156, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 156, + 157, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "range": Array [ + 157, + 160, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 13, + "line": 8, + }, + }, + "range": Array [ + 161, + 162, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 163, + 166, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 8, + }, + "start": Object { + "column": 18, + "line": 8, + }, + }, + "range": Array [ + 166, + 167, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 170, + 171, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 10, + }, + }, + "range": Array [ + 172, + 173, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-modifier.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-modifier.src.ts.shot new file mode 100644 index 00000000000..5a6a52818cb --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-modifier.src.ts.shot @@ -0,0 +1,591 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-constructor-and-modifier.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": "protected", + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 22, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 12, + 39, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 36, + 39, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 33, + 39, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": "public", + "computed": true, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 51, + 64, + ], + "raw": "'constructor'", + "type": "Literal", + "value": "constructor", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 43, + 71, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 68, + 71, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "params": Array [], + "range": Array [ + 65, + 71, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 73, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 73, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 74, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 12, + 21, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 33, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 43, + 49, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 51, + 64, + ], + "type": "String", + "value": "'constructor'", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 29, + "line": 4, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-parameter-property-with-modifiers.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-parameter-property-with-modifiers.src.ts.shot new file mode 100644 index 00000000000..894bb53449d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-parameter-property-with-modifiers.src.ts.shot @@ -0,0 +1,584 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-constructor-and-parameter-property-with-modifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 53, + 64, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 59, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 53, + 110, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 59, + "line": 2, + }, + "start": Object { + "column": 57, + "line": 2, + }, + }, + "range": Array [ + 108, + 110, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 59, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [ + Object { + "accessibility": "protected", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 55, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "override": true, + "parameter": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 55, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "name": "param", + "optional": false, + "range": Array [ + 93, + 106, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 2, + }, + "start": Object { + "column": 47, + "line": 2, + }, + }, + "range": Array [ + 98, + 106, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 2, + }, + "start": Object { + "column": 49, + "line": 2, + }, + }, + "range": Array [ + 100, + 106, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 65, + 106, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 64, + 110, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 112, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "SpecializedComponent", + "optional": false, + "range": Array [ + 6, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 112, + ], + "superClass": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "SomeComponent", + "optional": false, + "range": Array [ + 35, + 48, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 113, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 26, + ], + "type": "Identifier", + "value": "SpecializedComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 34, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 48, + ], + "type": "Identifier", + "value": "SomeComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 53, + 64, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 65, + 74, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 75, + 83, + ], + "type": "Identifier", + "value": "override", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 84, + 92, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "range": Array [ + 93, + 98, + ], + "type": "Identifier", + "value": "param", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 47, + "line": 2, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 2, + }, + "start": Object { + "column": 49, + "line": 2, + }, + }, + "range": Array [ + 100, + 106, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 2, + }, + "start": Object { + "column": 55, + "line": 2, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 2, + }, + "start": Object { + "column": 57, + "line": 2, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 2, + }, + "start": Object { + "column": 58, + "line": 2, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-parameter-proptery-with-override-modifier.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-parameter-proptery-with-override-modifier.src.ts.shot new file mode 100644 index 00000000000..34b890b13c3 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-parameter-proptery-with-override-modifier.src.ts.shot @@ -0,0 +1,676 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-constructor-and-parameter-proptery-with-override-modifier.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 53, + 64, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 53, + 109, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 97, + 102, + ], + "type": "Super", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "optional": false, + "range": Array [ + 97, + 104, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 97, + 105, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "range": Array [ + 89, + 109, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [ + Object { + "accessibility": undefined, + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "override": true, + "parameter": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "param", + "optional": false, + "range": Array [ + 74, + 87, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 79, + 87, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 81, + 87, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 65, + 87, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 64, + 109, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 111, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "SpecializedComponent", + "optional": false, + "range": Array [ + 6, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 111, + ], + "superClass": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "SomeComponent", + "optional": false, + "range": Array [ + 35, + 48, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 112, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 26, + ], + "type": "Identifier", + "value": "SpecializedComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 34, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 48, + ], + "type": "Identifier", + "value": "SomeComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 53, + 64, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 65, + 73, + ], + "type": "Identifier", + "value": "override", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 74, + 79, + ], + "type": "Identifier", + "value": "param", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 81, + 87, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 87, + 88, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 97, + 102, + ], + "type": "Keyword", + "value": "super", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 104, + 105, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-return-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-return-type.src.ts.shot new file mode 100644 index 00000000000..601f1dcb7db --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-return-type.src.ts.shot @@ -0,0 +1,693 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-constructor-and-return-type.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 12, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 12, + 37, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 23, + 37, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 33, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": true, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 42, + 55, + ], + "raw": "'constructor'", + "type": "Literal", + "value": "constructor", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 41, + 70, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 67, + 70, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "params": Array [], + "range": Array [ + 56, + 70, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 58, + 66, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 60, + 66, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 72, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 72, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 73, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 12, + 23, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 42, + 55, + ], + "type": "String", + "value": "'constructor'", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 60, + 66, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-type-parameters.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-type-parameters.src.ts.shot new file mode 100644 index 00000000000..f9fdbbc32f7 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-type-parameters.src.ts.shot @@ -0,0 +1,783 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-constructor-and-type-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 12, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 12, + 32, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 23, + 32, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 24, + 25, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 23, + 26, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + }, + Object { + "accessibility": undefined, + "computed": true, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 37, + 50, + ], + "raw": "'constructor'", + "type": "Literal", + "value": "constructor", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 36, + 60, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 57, + 60, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "params": Array [], + "range": Array [ + 51, + 60, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 52, + 53, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 51, + 54, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 62, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 62, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 63, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 12, + 23, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 37, + 50, + ], + "type": "String", + "value": "'constructor'", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 20, + "line": 4, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-declare-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-declare-properties.src.ts.shot new file mode 100644 index 00000000000..195cc59be38 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-declare-properties.src.ts.shot @@ -0,0 +1,1547 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-declare-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "declare": true, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "prop1", + "optional": false, + "range": Array [ + 28, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 20, + 42, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 33, + 41, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "declare": true, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "name": "prop2", + "optional": false, + "range": Array [ + 60, + 65, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 45, + 74, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 65, + 73, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 67, + 73, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": true, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "name": "prop3", + "optional": false, + "range": Array [ + 92, + 97, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 77, + 106, + ], + "readonly": false, + "static": true, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 4, + }, + }, + "range": Array [ + 97, + 105, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 99, + 105, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": true, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "name": "prop3", + "optional": false, + "range": Array [ + 126, + 131, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 109, + 140, + ], + "readonly": true, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 5, + }, + "start": Object { + "column": 24, + "line": 5, + }, + }, + "range": Array [ + 131, + 139, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 5, + }, + "start": Object { + "column": 26, + "line": 5, + }, + }, + "range": Array [ + 133, + 139, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "declare": true, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 6, + }, + "start": Object { + "column": 26, + "line": 6, + }, + }, + "name": "prop4", + "optional": false, + "range": Array [ + 167, + 172, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 143, + 181, + ], + "readonly": true, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 6, + }, + "start": Object { + "column": 31, + "line": 6, + }, + }, + "range": Array [ + 172, + 180, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 6, + }, + "start": Object { + "column": 33, + "line": 6, + }, + }, + "range": Array [ + 174, + 180, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "declare": true, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 7, + }, + "start": Object { + "column": 24, + "line": 7, + }, + }, + "name": "prop5", + "optional": false, + "range": Array [ + 206, + 211, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 184, + 220, + ], + "readonly": false, + "static": true, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 7, + }, + "start": Object { + "column": 29, + "line": 7, + }, + }, + "range": Array [ + 211, + 219, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 7, + }, + "start": Object { + "column": 31, + "line": 7, + }, + }, + "range": Array [ + 213, + 219, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "declare": true, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 8, + }, + "start": Object { + "column": 33, + "line": 8, + }, + }, + "name": "prop6", + "optional": false, + "range": Array [ + 254, + 259, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 47, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 223, + 268, + ], + "readonly": true, + "static": true, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 8, + }, + "start": Object { + "column": 38, + "line": 8, + }, + }, + "range": Array [ + 259, + 267, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 8, + }, + "start": Object { + "column": 40, + "line": 8, + }, + }, + "range": Array [ + 261, + 267, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 270, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "DeclProps", + "optional": false, + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 270, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 271, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + "value": "DeclProps", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 20, + 27, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 28, + 33, + ], + "type": "Identifier", + "value": "prop1", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 45, + 52, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 60, + 65, + ], + "type": "Identifier", + "value": "prop2", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 67, + 73, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 77, + 84, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 85, + 91, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 92, + 97, + ], + "type": "Identifier", + "value": "prop3", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 4, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 99, + 105, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 109, + 116, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 117, + 125, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 126, + 131, + ], + "type": "Identifier", + "value": "prop3", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 24, + "line": 5, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 5, + }, + "start": Object { + "column": 26, + "line": 5, + }, + }, + "range": Array [ + 133, + 139, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 5, + }, + "start": Object { + "column": 32, + "line": 5, + }, + }, + "range": Array [ + 139, + 140, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 143, + 150, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 151, + 157, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 158, + 166, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 6, + }, + "start": Object { + "column": 26, + "line": 6, + }, + }, + "range": Array [ + 167, + 172, + ], + "type": "Identifier", + "value": "prop4", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 6, + }, + "start": Object { + "column": 31, + "line": 6, + }, + }, + "range": Array [ + 172, + 173, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 6, + }, + "start": Object { + "column": 33, + "line": 6, + }, + }, + "range": Array [ + 174, + 180, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 6, + }, + "start": Object { + "column": 39, + "line": 6, + }, + }, + "range": Array [ + 180, + 181, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 184, + 191, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 192, + 198, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 199, + 205, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 7, + }, + "start": Object { + "column": 24, + "line": 7, + }, + }, + "range": Array [ + 206, + 211, + ], + "type": "Identifier", + "value": "prop5", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 7, + }, + "start": Object { + "column": 29, + "line": 7, + }, + }, + "range": Array [ + 211, + 212, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 7, + }, + "start": Object { + "column": 31, + "line": 7, + }, + }, + "range": Array [ + 213, + 219, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 7, + }, + "start": Object { + "column": 37, + "line": 7, + }, + }, + "range": Array [ + 219, + 220, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 223, + 230, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 8, + }, + }, + "range": Array [ + 231, + 237, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 8, + }, + "start": Object { + "column": 17, + "line": 8, + }, + }, + "range": Array [ + 238, + 244, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 8, + }, + "start": Object { + "column": 24, + "line": 8, + }, + }, + "range": Array [ + 245, + 253, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 8, + }, + "start": Object { + "column": 33, + "line": 8, + }, + }, + "range": Array [ + 254, + 259, + ], + "type": "Identifier", + "value": "prop6", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 8, + }, + "start": Object { + "column": 38, + "line": 8, + }, + }, + "range": Array [ + 259, + 260, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 8, + }, + "start": Object { + "column": 40, + "line": 8, + }, + }, + "range": Array [ + 261, + 267, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 8, + }, + "start": Object { + "column": 46, + "line": 8, + }, + }, + "range": Array [ + 267, + 268, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 269, + 270, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-definite-assignment.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-definite-assignment.src.ts.shot new file mode 100644 index 00000000000..e767114ee28 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-definite-assignment.src.ts.shot @@ -0,0 +1,335 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-definite-assignment.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": true, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 12, + 23, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 22, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 25, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-export-parameter-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-export-parameter-properties.src.ts.shot new file mode 100644 index 00000000000..fd77a07d3f4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-export-parameter-properties.src.ts.shot @@ -0,0 +1,492 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-export-parameter-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 16, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 16, + 54, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 54, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "accessibility": undefined, + "decorators": Array [], + "export": true, + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "override": false, + "parameter": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 35, + 44, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 36, + 44, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 28, + 44, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 27, + 54, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 56, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 58, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 27, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 34, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-extends-and-implements.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-extends-and-implements.src.ts.shot new file mode 100644 index 00000000000..77813357b3f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-extends-and-implements.src.ts.shot @@ -0,0 +1,294 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-extends-and-implements.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 78, + "line": 1, + }, + }, + "range": Array [ + 78, + 80, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "ClassWithParentAndInterface", + "optional": false, + "range": Array [ + 6, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 66, + "line": 1, + }, + }, + "name": "MyInterface", + "optional": false, + "range": Array [ + 66, + 77, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 66, + "line": 1, + }, + }, + "range": Array [ + 66, + 77, + ], + "type": "TSClassImplements", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 80, + ], + "superClass": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "name": "MyOtherClass", + "optional": false, + "range": Array [ + 42, + 54, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 81, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 33, + ], + "type": "Identifier", + "value": "ClassWithParentAndInterface", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 54, + ], + "type": "Identifier", + "value": "MyOtherClass", + }, + Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 1, + }, + "start": Object { + "column": 55, + "line": 1, + }, + }, + "range": Array [ + 55, + 65, + ], + "type": "Keyword", + "value": "implements", + }, + Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 66, + "line": 1, + }, + }, + "range": Array [ + 66, + 77, + ], + "type": "Identifier", + "value": "MyInterface", + }, + Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 1, + }, + "start": Object { + "column": 78, + "line": 1, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 79, + "line": 1, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-extends-generic-multiple.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-extends-generic-multiple.src.ts.shot new file mode 100644 index 00000000000..f6f2652718e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-extends-generic-multiple.src.ts.shot @@ -0,0 +1,592 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-extends-generic-multiple.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 45, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "superClass": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "name": "Bar", + "optional": false, + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "superTypeParameters": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "C", + "optional": false, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "name": "D", + "optional": false, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 34, + 40, + ], + "type": "TSTypeParameterInstantiation", + }, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "B", + "optional": false, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 10, + 21, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 9, + 22, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 46, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 19, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 30, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "value": "D", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-extends-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-extends-generic.src.ts.shot new file mode 100644 index 00000000000..e569978121f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-extends-generic.src.ts.shot @@ -0,0 +1,443 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-extends-generic.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 32, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "superClass": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "Bar", + "optional": false, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "superTypeParameters": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "B", + "optional": false, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 24, + 27, + ], + "type": "TSTypeParameterInstantiation", + }, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 10, + 11, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 9, + 12, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 20, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-generic-method-default.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-generic-method-default.src.ts.shot new file mode 100644 index 00000000000..8e4836a5ead --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-generic-method-default.src.ts.shot @@ -0,0 +1,530 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-generic-method-default.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "getBar", + "optional": false, + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 34, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 32, + 34, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 20, + 34, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "Bar", + "optional": false, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "in": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 21, + 28, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 20, + 29, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 36, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + "value": "getBar", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-generic-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-generic-method.src.ts.shot new file mode 100644 index 00000000000..c79899448ef --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-generic-method.src.ts.shot @@ -0,0 +1,456 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-generic-method.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "getBar", + "optional": false, + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 28, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 26, + 28, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 20, + 28, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 21, + 22, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 20, + 23, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 30, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + "value": "getBar", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements-and-extends.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements-and-extends.src.ts.shot new file mode 100644 index 00000000000..8e00330e79b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements-and-extends.src.ts.shot @@ -0,0 +1,294 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-implements-and-extends.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 78, + "line": 1, + }, + }, + "range": Array [ + 78, + 80, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "ClassWithParentAndInterface", + "optional": false, + "range": Array [ + 6, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "name": "MyInterface", + "optional": false, + "range": Array [ + 45, + 56, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 56, + ], + "type": "TSClassImplements", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 80, + ], + "superClass": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 65, + "line": 1, + }, + }, + "name": "MyOtherClass", + "optional": false, + "range": Array [ + 65, + 77, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 81, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 33, + ], + "type": "Identifier", + "value": "ClassWithParentAndInterface", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 44, + ], + "type": "Keyword", + "value": "implements", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 56, + ], + "type": "Identifier", + "value": "MyInterface", + }, + Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 57, + "line": 1, + }, + }, + "range": Array [ + 57, + 64, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 65, + "line": 1, + }, + }, + "range": Array [ + 65, + 77, + ], + "type": "Identifier", + "value": "MyOtherClass", + }, + Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 1, + }, + "start": Object { + "column": 78, + "line": 1, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 79, + "line": 1, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements-generic-multiple.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements-generic-multiple.src.ts.shot new file mode 100644 index 00000000000..ad5f6cb5f24 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements-generic-multiple.src.ts.shot @@ -0,0 +1,424 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-implements-generic-multiple.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 35, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "Bar", + "optional": false, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 30, + ], + "type": "TSClassImplements", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "S", + "optional": false, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 24, + 30, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 20, + ], + "type": "Keyword", + "value": "implements", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "S", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements-generic.src.ts.shot new file mode 100644 index 00000000000..1309c2bd42e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements-generic.src.ts.shot @@ -0,0 +1,349 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-implements-generic.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 32, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "Bar", + "optional": false, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "TSClassImplements", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "S", + "optional": false, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 24, + 27, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 20, + ], + "type": "Keyword", + "value": "implements", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "S", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements.src.ts.shot new file mode 100644 index 00000000000..4168e15a30f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-implements.src.ts.shot @@ -0,0 +1,238 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-implements.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 29, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "Bar", + "optional": false, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "TSClassImplements", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 20, + ], + "type": "Keyword", + "value": "implements", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-method.src.ts.shot new file mode 100644 index 00000000000..2948805166c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-method.src.ts.shot @@ -0,0 +1,883 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-method.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 12, + 29, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 15, + 29, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 25, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 32, + 44, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 41, + 44, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 35, + 44, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 36, + 37, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 35, + 38, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 47, + 55, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 53, + 55, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "params": Array [], + "range": Array [ + 50, + 55, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 57, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 57, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 58, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-mixin-reference.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-mixin-reference.src.ts.shot new file mode 100644 index 00000000000..ffd5aa93d96 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-mixin-reference.src.ts.shot @@ -0,0 +1,628 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-mixin-reference.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 49, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "M", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "name": "Base", + "optional": false, + "range": Array [ + 37, + 44, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 44, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 0, + 49, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 35, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "Constructor", + "optional": false, + "range": Array [ + 21, + 32, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "name": "M", + "optional": false, + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 32, + 35, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 11, + 35, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 10, + 36, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "M", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 20, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 32, + ], + "type": "Identifier", + "value": "Constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + "value": "M", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 41, + ], + "type": "Identifier", + "value": "Base", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-mixin.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-mixin.src.ts.shot new file mode 100644 index 00000000000..131bd49f8de --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-mixin.src.ts.shot @@ -0,0 +1,2125 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-mixin.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 79, + 82, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": null, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 60, + 82, + ], + "superClass": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "Base", + "optional": false, + "range": Array [ + 74, + 78, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "superTypeParameters": undefined, + "type": "ClassExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 53, + 82, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 84, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "M", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "name": "Base", + "optional": false, + "range": Array [ + 38, + 45, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 0, + 84, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 36, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "Constructor", + "optional": false, + "range": Array [ + 21, + 32, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "members": Array [], + "range": Array [ + 33, + 35, + ], + "type": "TSTypeLiteral", + }, + ], + "range": Array [ + 32, + 36, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 11, + 36, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 10, + 37, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 5, + }, + "start": Object { + "column": 39, + "line": 5, + }, + }, + "range": Array [ + 125, + 128, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 5, + }, + "start": Object { + "column": 37, + "line": 5, + }, + }, + "name": "I", + "optional": false, + "range": Array [ + 123, + 124, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 5, + }, + "start": Object { + "column": 37, + "line": 5, + }, + }, + "range": Array [ + 123, + 124, + ], + "type": "TSClassImplements", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 86, + 128, + ], + "superClass": Object { + "arguments": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 23, + "line": 5, + }, + }, + "name": "C", + "optional": false, + "range": Array [ + 109, + 110, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "name": "M", + "optional": false, + "range": Array [ + 102, + 103, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "optional": false, + "range": Array [ + 102, + 111, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 104, + 107, + ], + "type": "TSAnyKeyword", + }, + ], + "range": Array [ + 103, + 108, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 138, + 141, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "name": "C", + "optional": false, + "range": Array [ + 136, + 137, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 130, + 141, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 12, + "line": 8, + }, + }, + "range": Array [ + 154, + 157, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 8, + }, + }, + "name": "I", + "optional": false, + "range": Array [ + 152, + 153, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 142, + 157, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 5, + "line": 9, + }, + }, + "name": "Constructor", + "optional": false, + "range": Array [ + 163, + 174, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 48, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 158, + 206, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "abstract": false, + "loc": Object { + "end": Object { + "column": 47, + "line": 9, + }, + "start": Object { + "column": 22, + "line": 9, + }, + }, + "params": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 9, + }, + "start": Object { + "column": 30, + "line": 9, + }, + }, + "name": "args", + "optional": false, + "range": Array [ + 188, + 192, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 41, + "line": 9, + }, + "start": Object { + "column": 27, + "line": 9, + }, + }, + "optional": false, + "range": Array [ + 185, + 199, + ], + "type": "RestElement", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 9, + }, + "start": Object { + "column": 34, + "line": 9, + }, + }, + "range": Array [ + 192, + 199, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 9, + }, + "start": Object { + "column": 36, + "line": 9, + }, + }, + "range": Array [ + 194, + 197, + ], + "type": "TSAnyKeyword", + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 9, + }, + "start": Object { + "column": 36, + "line": 9, + }, + }, + "range": Array [ + 194, + 199, + ], + "type": "TSArrayType", + }, + }, + "value": undefined, + }, + ], + "range": Array [ + 180, + 205, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 9, + }, + "start": Object { + "column": 43, + "line": 9, + }, + }, + "range": Array [ + 201, + 205, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 9, + }, + "start": Object { + "column": 46, + "line": 9, + }, + }, + "range": Array [ + 204, + 205, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 47, + "line": 9, + }, + "start": Object { + "column": 46, + "line": 9, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 204, + 205, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "type": "TSConstructorType", + "typeParameters": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 9, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 17, + "line": 9, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 17, + "line": 9, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 175, + 176, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 175, + 176, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 174, + 177, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 207, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "M", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 20, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 32, + ], + "type": "Identifier", + "value": "Constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 42, + ], + "type": "Identifier", + "value": "Base", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 60, + 65, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 66, + 73, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 74, + 78, + ], + "type": "Identifier", + "value": "Base", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 86, + 91, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 94, + 101, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Identifier", + "value": "M", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 104, + 107, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 21, + "line": 5, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 23, + "line": 5, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 24, + "line": 5, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 26, + "line": 5, + }, + }, + "range": Array [ + 112, + 122, + ], + "type": "Keyword", + "value": "implements", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 5, + }, + "start": Object { + "column": 37, + "line": 5, + }, + }, + "range": Array [ + 123, + 124, + ], + "type": "Identifier", + "value": "I", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 5, + }, + "start": Object { + "column": 39, + "line": 5, + }, + }, + "range": Array [ + 125, + 126, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 5, + }, + "start": Object { + "column": 41, + "line": 5, + }, + }, + "range": Array [ + 127, + 128, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 130, + 135, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 138, + 139, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 140, + 141, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 142, + 151, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 8, + }, + }, + "range": Array [ + 152, + 153, + ], + "type": "Identifier", + "value": "I", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 8, + }, + "start": Object { + "column": 12, + "line": 8, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 14, + "line": 8, + }, + }, + "range": Array [ + 156, + 157, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 158, + 162, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 5, + "line": 9, + }, + }, + "range": Array [ + 163, + 174, + ], + "type": "Identifier", + "value": "Constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 9, + }, + }, + "range": Array [ + 174, + 175, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 17, + "line": 9, + }, + }, + "range": Array [ + 175, + 176, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 18, + "line": 9, + }, + }, + "range": Array [ + 176, + 177, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 9, + }, + "start": Object { + "column": 20, + "line": 9, + }, + }, + "range": Array [ + 178, + 179, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 9, + }, + "start": Object { + "column": 22, + "line": 9, + }, + }, + "range": Array [ + 180, + 183, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 9, + }, + "start": Object { + "column": 26, + "line": 9, + }, + }, + "range": Array [ + 184, + 185, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 9, + }, + "start": Object { + "column": 27, + "line": 9, + }, + }, + "range": Array [ + 185, + 188, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 9, + }, + "start": Object { + "column": 30, + "line": 9, + }, + }, + "range": Array [ + 188, + 192, + ], + "type": "Identifier", + "value": "args", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 9, + }, + "start": Object { + "column": 34, + "line": 9, + }, + }, + "range": Array [ + 192, + 193, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 9, + }, + "start": Object { + "column": 36, + "line": 9, + }, + }, + "range": Array [ + 194, + 197, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 9, + }, + "start": Object { + "column": 39, + "line": 9, + }, + }, + "range": Array [ + 197, + 198, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 9, + }, + "start": Object { + "column": 40, + "line": 9, + }, + }, + "range": Array [ + 198, + 199, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 9, + }, + "start": Object { + "column": 41, + "line": 9, + }, + }, + "range": Array [ + 199, + 200, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 9, + }, + "start": Object { + "column": 43, + "line": 9, + }, + }, + "range": Array [ + 201, + 203, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 9, + }, + "start": Object { + "column": 46, + "line": 9, + }, + }, + "range": Array [ + 204, + 205, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 9, + }, + "start": Object { + "column": 47, + "line": 9, + }, + }, + "range": Array [ + 205, + 206, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-computed-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-computed-method.src.ts.shot new file mode 100644 index 00000000000..6841a4cb34f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-computed-method.src.ts.shot @@ -0,0 +1,3185 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-optional-computed-method.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "computed1", + "optional": false, + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 24, + ], + "raw": "\\"buzz\\"", + "type": "Literal", + "value": "buzz", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 24, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "computed2", + "optional": false, + "range": Array [ + 32, + 41, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 44, + 50, + ], + "raw": "\\"bazz\\"", + "type": "Literal", + "value": "bazz", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 32, + 50, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 26, + 51, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "obj", + "optional": false, + "range": Array [ + 58, + 61, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "member", + "optional": false, + "range": Array [ + 68, + 74, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 68, + 84, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 76, + 84, + ], + "raw": "\\"member\\"", + "type": "Literal", + "value": "member", + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "member2", + "optional": false, + "range": Array [ + 88, + 95, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 88, + 106, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 97, + 106, + ], + "raw": "\\"member2\\"", + "type": "Literal", + "value": "member2", + }, + }, + ], + "range": Array [ + 64, + 109, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 58, + 109, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 52, + 110, + ], + "type": "VariableDeclaration", + }, + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": true, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 3, + "line": 8, + }, + }, + "name": "computed1", + "optional": false, + "range": Array [ + 124, + 133, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 17, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 123, + 138, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": null, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 17, + "line": 8, + }, + "start": Object { + "column": 14, + "line": 8, + }, + }, + "params": Array [], + "range": Array [ + 135, + 138, + ], + "returnType": undefined, + "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": true, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "name": "computed2", + "optional": false, + "range": Array [ + 142, + 151, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 141, + 158, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 17, + "line": 9, + }, + }, + "range": Array [ + 156, + 158, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 14, + "line": 9, + }, + }, + "params": Array [], + "range": Array [ + 153, + 158, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": true, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 10, + }, + "start": Object { + "column": 3, + "line": 10, + }, + }, + "range": Array [ + 163, + 164, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 162, + 169, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": null, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 6, + "line": 10, + }, + }, + "params": Array [], + "range": Array [ + 166, + 169, + ], + "returnType": undefined, + "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": true, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 11, + }, + "start": Object { + "column": 3, + "line": 11, + }, + }, + "range": Array [ + 173, + 174, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 11, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 172, + 181, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 11, + }, + "start": Object { + "column": 9, + "line": 11, + }, + }, + "range": Array [ + 179, + 181, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 11, + }, + "start": Object { + "column": 6, + "line": 11, + }, + }, + "params": Array [], + "range": Array [ + 176, + 181, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": true, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 12, + }, + "start": Object { + "column": 3, + "line": 12, + }, + }, + "range": Array [ + 186, + 196, + ], + "raw": "\\"literal1\\"", + "type": "Literal", + "value": "literal1", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 18, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 185, + 201, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": null, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 18, + "line": 12, + }, + "start": Object { + "column": 15, + "line": 12, + }, + }, + "params": Array [], + "range": Array [ + 198, + 201, + ], + "returnType": undefined, + "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": true, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 13, + }, + "start": Object { + "column": 3, + "line": 13, + }, + }, + "range": Array [ + 205, + 215, + ], + "raw": "\\"literal2\\"", + "type": "Literal", + "value": "literal2", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 20, + "line": 13, + }, + "start": Object { + "column": 2, + "line": 13, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 204, + 222, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 13, + }, + "start": Object { + "column": 18, + "line": 13, + }, + }, + "range": Array [ + 220, + 222, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 20, + "line": 13, + }, + "start": Object { + "column": 15, + "line": 13, + }, + }, + "params": Array [], + "range": Array [ + 217, + 222, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": true, + "decorators": Array [], + "key": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 13, + "line": 14, + }, + "start": Object { + "column": 3, + "line": 14, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 14, + }, + "start": Object { + "column": 3, + "line": 14, + }, + }, + "name": "obj", + "optional": false, + "range": Array [ + 227, + 230, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 14, + }, + "start": Object { + "column": 7, + "line": 14, + }, + }, + "name": "member", + "optional": false, + "range": Array [ + 231, + 237, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 227, + 237, + ], + "type": "MemberExpression", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 20, + "line": 14, + }, + "start": Object { + "column": 2, + "line": 14, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 226, + 244, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 14, + }, + "start": Object { + "column": 18, + "line": 14, + }, + }, + "range": Array [ + 242, + 244, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 20, + "line": 14, + }, + "start": Object { + "column": 15, + "line": 14, + }, + }, + "params": Array [], + "range": Array [ + 239, + 244, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": true, + "decorators": Array [], + "key": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 14, + "line": 15, + }, + "start": Object { + "column": 3, + "line": 15, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 15, + }, + "start": Object { + "column": 3, + "line": 15, + }, + }, + "name": "obj", + "optional": false, + "range": Array [ + 249, + 252, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 15, + }, + "start": Object { + "column": 7, + "line": 15, + }, + }, + "name": "member2", + "optional": false, + "range": Array [ + 253, + 260, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 249, + 260, + ], + "type": "MemberExpression", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 19, + "line": 15, + }, + "start": Object { + "column": 2, + "line": 15, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 248, + 265, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": null, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 19, + "line": 15, + }, + "start": Object { + "column": 16, + "line": 15, + }, + }, + "params": Array [], + "range": Array [ + 262, + 265, + ], + "returnType": undefined, + "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": true, + "decorators": Array [], + "key": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 16, + }, + "start": Object { + "column": 3, + "line": 16, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 269, + 270, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 16, + }, + "start": Object { + "column": 3, + "line": 16, + }, + }, + "optional": false, + "range": Array [ + 269, + 272, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 13, + "line": 16, + }, + "start": Object { + "column": 2, + "line": 16, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 268, + 279, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 16, + }, + "start": Object { + "column": 11, + "line": 16, + }, + }, + "range": Array [ + 277, + 279, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 13, + "line": 16, + }, + "start": Object { + "column": 8, + "line": 16, + }, + }, + "params": Array [], + "range": Array [ + 274, + 279, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 17, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 119, + 281, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 117, + 118, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 17, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 111, + 281, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 18, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 282, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + "value": "computed1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 24, + ], + "type": "String", + "value": "\\"buzz\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 26, + 31, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 32, + 41, + ], + "type": "Identifier", + "value": "computed2", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 44, + 50, + ], + "type": "String", + "value": "\\"bazz\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 52, + 57, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 58, + 61, + ], + "type": "Identifier", + "value": "obj", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "Identifier", + "value": "member", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 76, + 84, + ], + "type": "String", + "value": "\\"member\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 88, + 95, + ], + "type": "Identifier", + "value": "member2", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 97, + 106, + ], + "type": "String", + "value": "\\"member2\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 111, + 116, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 119, + 120, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 123, + 124, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 3, + "line": 8, + }, + }, + "range": Array [ + 124, + 133, + ], + "type": "Identifier", + "value": "computed1", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 8, + }, + "start": Object { + "column": 12, + "line": 8, + }, + }, + "range": Array [ + 133, + 134, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 13, + "line": 8, + }, + }, + "range": Array [ + 134, + 135, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 14, + "line": 8, + }, + }, + "range": Array [ + 135, + 136, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 8, + }, + "start": Object { + "column": 16, + "line": 8, + }, + }, + "range": Array [ + 137, + 138, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 141, + 142, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "range": Array [ + 142, + 151, + ], + "type": "Identifier", + "value": "computed2", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "range": Array [ + 151, + 152, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 9, + }, + "start": Object { + "column": 13, + "line": 9, + }, + }, + "range": Array [ + 152, + 153, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 9, + }, + "start": Object { + "column": 14, + "line": 9, + }, + }, + "range": Array [ + 153, + 154, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 15, + "line": 9, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 17, + "line": 9, + }, + }, + "range": Array [ + 156, + 157, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 18, + "line": 9, + }, + }, + "range": Array [ + 157, + 158, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 9, + }, + "start": Object { + "column": 19, + "line": 9, + }, + }, + "range": Array [ + 158, + 159, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 162, + 163, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 10, + }, + "start": Object { + "column": 3, + "line": 10, + }, + }, + "range": Array [ + 163, + 164, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 10, + }, + }, + "range": Array [ + 164, + 165, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 10, + }, + "start": Object { + "column": 5, + "line": 10, + }, + }, + "range": Array [ + 165, + 166, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 10, + }, + "start": Object { + "column": 6, + "line": 10, + }, + }, + "range": Array [ + 166, + 167, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 10, + }, + "start": Object { + "column": 7, + "line": 10, + }, + }, + "range": Array [ + 167, + 168, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "range": Array [ + 168, + 169, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "range": Array [ + 172, + 173, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 11, + }, + "start": Object { + "column": 3, + "line": 11, + }, + }, + "range": Array [ + 173, + 174, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "range": Array [ + 174, + 175, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 11, + }, + "start": Object { + "column": 5, + "line": 11, + }, + }, + "range": Array [ + 175, + 176, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 11, + }, + "start": Object { + "column": 6, + "line": 11, + }, + }, + "range": Array [ + 176, + 177, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 11, + }, + "start": Object { + "column": 7, + "line": 11, + }, + }, + "range": Array [ + 177, + 178, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 11, + }, + "start": Object { + "column": 9, + "line": 11, + }, + }, + "range": Array [ + 179, + 180, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 11, + }, + "start": Object { + "column": 10, + "line": 11, + }, + }, + "range": Array [ + 180, + 181, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 11, + }, + "start": Object { + "column": 11, + "line": 11, + }, + }, + "range": Array [ + 181, + 182, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "range": Array [ + 185, + 186, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 12, + }, + "start": Object { + "column": 3, + "line": 12, + }, + }, + "range": Array [ + 186, + 196, + ], + "type": "String", + "value": "\\"literal1\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 12, + }, + "start": Object { + "column": 13, + "line": 12, + }, + }, + "range": Array [ + 196, + 197, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 12, + }, + "start": Object { + "column": 14, + "line": 12, + }, + }, + "range": Array [ + 197, + 198, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 12, + }, + "start": Object { + "column": 15, + "line": 12, + }, + }, + "range": Array [ + 198, + 199, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 12, + }, + "start": Object { + "column": 16, + "line": 12, + }, + }, + "range": Array [ + 199, + 200, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 12, + }, + "start": Object { + "column": 17, + "line": 12, + }, + }, + "range": Array [ + 200, + 201, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 13, + }, + "start": Object { + "column": 2, + "line": 13, + }, + }, + "range": Array [ + 204, + 205, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 13, + }, + "start": Object { + "column": 3, + "line": 13, + }, + }, + "range": Array [ + 205, + 215, + ], + "type": "String", + "value": "\\"literal2\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 13, + }, + "start": Object { + "column": 13, + "line": 13, + }, + }, + "range": Array [ + 215, + 216, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 13, + }, + "start": Object { + "column": 14, + "line": 13, + }, + }, + "range": Array [ + 216, + 217, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 13, + }, + "start": Object { + "column": 15, + "line": 13, + }, + }, + "range": Array [ + 217, + 218, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 13, + }, + "start": Object { + "column": 16, + "line": 13, + }, + }, + "range": Array [ + 218, + 219, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 13, + }, + "start": Object { + "column": 18, + "line": 13, + }, + }, + "range": Array [ + 220, + 221, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 13, + }, + "start": Object { + "column": 19, + "line": 13, + }, + }, + "range": Array [ + 221, + 222, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 13, + }, + "start": Object { + "column": 20, + "line": 13, + }, + }, + "range": Array [ + 222, + 223, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 14, + }, + "start": Object { + "column": 2, + "line": 14, + }, + }, + "range": Array [ + 226, + 227, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 14, + }, + "start": Object { + "column": 3, + "line": 14, + }, + }, + "range": Array [ + 227, + 230, + ], + "type": "Identifier", + "value": "obj", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 14, + }, + "start": Object { + "column": 6, + "line": 14, + }, + }, + "range": Array [ + 230, + 231, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 14, + }, + "start": Object { + "column": 7, + "line": 14, + }, + }, + "range": Array [ + 231, + 237, + ], + "type": "Identifier", + "value": "member", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 14, + }, + "start": Object { + "column": 13, + "line": 14, + }, + }, + "range": Array [ + 237, + 238, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 14, + }, + "start": Object { + "column": 14, + "line": 14, + }, + }, + "range": Array [ + 238, + 239, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 14, + }, + "start": Object { + "column": 15, + "line": 14, + }, + }, + "range": Array [ + 239, + 240, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 14, + }, + "start": Object { + "column": 16, + "line": 14, + }, + }, + "range": Array [ + 240, + 241, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 14, + }, + "start": Object { + "column": 18, + "line": 14, + }, + }, + "range": Array [ + 242, + 243, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 14, + }, + "start": Object { + "column": 19, + "line": 14, + }, + }, + "range": Array [ + 243, + 244, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 14, + }, + "start": Object { + "column": 20, + "line": 14, + }, + }, + "range": Array [ + 244, + 245, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 15, + }, + "start": Object { + "column": 2, + "line": 15, + }, + }, + "range": Array [ + 248, + 249, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 15, + }, + "start": Object { + "column": 3, + "line": 15, + }, + }, + "range": Array [ + 249, + 252, + ], + "type": "Identifier", + "value": "obj", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 15, + }, + "start": Object { + "column": 6, + "line": 15, + }, + }, + "range": Array [ + 252, + 253, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 15, + }, + "start": Object { + "column": 7, + "line": 15, + }, + }, + "range": Array [ + 253, + 260, + ], + "type": "Identifier", + "value": "member2", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 15, + }, + "start": Object { + "column": 14, + "line": 15, + }, + }, + "range": Array [ + 260, + 261, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 15, + }, + "start": Object { + "column": 15, + "line": 15, + }, + }, + "range": Array [ + 261, + 262, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 15, + }, + "start": Object { + "column": 16, + "line": 15, + }, + }, + "range": Array [ + 262, + 263, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 15, + }, + "start": Object { + "column": 17, + "line": 15, + }, + }, + "range": Array [ + 263, + 264, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 15, + }, + "start": Object { + "column": 18, + "line": 15, + }, + }, + "range": Array [ + 264, + 265, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 16, + }, + "start": Object { + "column": 2, + "line": 16, + }, + }, + "range": Array [ + 268, + 269, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 16, + }, + "start": Object { + "column": 3, + "line": 16, + }, + }, + "range": Array [ + 269, + 270, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 16, + }, + "start": Object { + "column": 4, + "line": 16, + }, + }, + "range": Array [ + 270, + 271, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 16, + }, + "start": Object { + "column": 5, + "line": 16, + }, + }, + "range": Array [ + 271, + 272, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 16, + }, + "start": Object { + "column": 6, + "line": 16, + }, + }, + "range": Array [ + 272, + 273, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 16, + }, + "start": Object { + "column": 7, + "line": 16, + }, + }, + "range": Array [ + 273, + 274, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 16, + }, + "start": Object { + "column": 8, + "line": 16, + }, + }, + "range": Array [ + 274, + 275, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 16, + }, + "start": Object { + "column": 9, + "line": 16, + }, + }, + "range": Array [ + 275, + 276, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 16, + }, + "start": Object { + "column": 11, + "line": 16, + }, + }, + "range": Array [ + 277, + 278, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 16, + }, + "start": Object { + "column": 12, + "line": 16, + }, + }, + "range": Array [ + 278, + 279, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 17, + }, + "start": Object { + "column": 0, + "line": 17, + }, + }, + "range": Array [ + 280, + 281, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-computed-property.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-computed-property.src.ts.shot new file mode 100644 index 00000000000..4fece8014eb --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-computed-property.src.ts.shot @@ -0,0 +1,374 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-optional-computed-property.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": "private", + "computed": true, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 28, + ], + "raw": "'foo'", + "type": "Literal", + "value": "foo", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 14, + 43, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "undefined", + "optional": false, + "range": Array [ + 33, + 42, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 45, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 46, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 28, + ], + "type": "String", + "value": "'foo'", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 33, + 42, + ], + "type": "Identifier", + "value": "undefined", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-methods.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-methods.src.ts.shot new file mode 100644 index 00000000000..1b5fc09b085 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-methods.src.ts.shot @@ -0,0 +1,805 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-optional-methods.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 14, + 21, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": null, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 18, + 21, + ], + "returnType": undefined, + "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 24, + 39, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": null, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 28, + 39, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 30, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSStringKeyword", + }, + }, + "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": "private", + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 50, + 53, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 42, + 65, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": null, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "params": Array [], + "range": Array [ + 54, + 65, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 56, + 64, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "TSStringKeyword", + }, + }, + "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 67, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 67, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 68, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 42, + 49, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 50, + 53, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-properties.src.ts.shot new file mode 100644 index 00000000000..8c685b95703 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-properties.src.ts.shot @@ -0,0 +1,1999 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-optional-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "computed", + "optional": false, + "range": Array [ + 6, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 23, + ], + "raw": "'buzz'", + "type": "Literal", + "value": "buzz", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 23, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "computed2", + "optional": false, + "range": Array [ + 31, + 40, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 43, + 49, + ], + "raw": "'bazz'", + "type": "Literal", + "value": "bazz", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 31, + 49, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 25, + 50, + ], + "type": "VariableDeclaration", + }, + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 65, + 68, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 65, + 70, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": null, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 73, + 76, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 73, + 87, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 78, + 86, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 80, + 86, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "private", + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 98, + 101, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 90, + 112, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 15, + "line": 6, + }, + }, + "range": Array [ + 103, + 111, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 105, + 111, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": undefined, + "computed": true, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "name": "computed", + "optional": false, + "range": Array [ + 116, + 124, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 115, + 127, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": null, + }, + Object { + "accessibility": undefined, + "computed": true, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 3, + "line": 8, + }, + }, + "range": Array [ + 131, + 140, + ], + "raw": "'literal'", + "type": "Literal", + "value": "literal", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 130, + 143, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": null, + }, + Object { + "accessibility": undefined, + "computed": true, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "range": Array [ + 147, + 148, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 146, + 151, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": null, + }, + Object { + "accessibility": undefined, + "computed": true, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 10, + }, + "start": Object { + "column": 3, + "line": 10, + }, + }, + "name": "computed2", + "optional": false, + "range": Array [ + 155, + 164, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 154, + 175, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 10, + }, + "start": Object { + "column": 14, + "line": 10, + }, + }, + "range": Array [ + 166, + 174, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 10, + }, + "start": Object { + "column": 16, + "line": 10, + }, + }, + "range": Array [ + 168, + 174, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": undefined, + "computed": true, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 11, + }, + "start": Object { + "column": 3, + "line": 11, + }, + }, + "range": Array [ + 179, + 189, + ], + "raw": "'literal2'", + "type": "Literal", + "value": "literal2", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 178, + 200, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 11, + }, + "start": Object { + "column": 15, + "line": 11, + }, + }, + "range": Array [ + 191, + 199, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 11, + }, + "start": Object { + "column": 17, + "line": 11, + }, + }, + "range": Array [ + 193, + 199, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": undefined, + "computed": true, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 12, + }, + "start": Object { + "column": 3, + "line": 12, + }, + }, + "range": Array [ + 204, + 205, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 203, + 216, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 12, + }, + "start": Object { + "column": 6, + "line": 12, + }, + }, + "range": Array [ + 207, + 215, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 12, + }, + "start": Object { + "column": 8, + "line": 12, + }, + }, + "range": Array [ + 209, + 215, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 61, + 218, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 57, + 60, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 51, + 218, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 14, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 219, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "Identifier", + "value": "computed", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 23, + ], + "type": "String", + "value": "'buzz'", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 25, + 30, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 31, + 40, + ], + "type": "Identifier", + "value": "computed2", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 43, + 49, + ], + "type": "String", + "value": "'bazz'", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 51, + 56, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 57, + 60, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 65, + 68, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 73, + 76, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 80, + 86, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 90, + 97, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 98, + 101, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 101, + 102, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 15, + "line": 6, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 105, + 111, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "range": Array [ + 116, + 124, + ], + "type": "Identifier", + "value": "computed", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 125, + 126, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 126, + 127, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 3, + "line": 8, + }, + }, + "range": Array [ + 131, + 140, + ], + "type": "String", + "value": "'literal'", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 8, + }, + "start": Object { + "column": 12, + "line": 8, + }, + }, + "range": Array [ + 140, + 141, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 13, + "line": 8, + }, + }, + "range": Array [ + 141, + 142, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 14, + "line": 8, + }, + }, + "range": Array [ + 142, + 143, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 146, + 147, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "range": Array [ + 147, + 148, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 148, + 149, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 9, + }, + "start": Object { + "column": 5, + "line": 9, + }, + }, + "range": Array [ + 149, + 150, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 9, + }, + }, + "range": Array [ + 150, + 151, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 10, + }, + "start": Object { + "column": 3, + "line": 10, + }, + }, + "range": Array [ + 155, + 164, + ], + "type": "Identifier", + "value": "computed2", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 10, + }, + "start": Object { + "column": 12, + "line": 10, + }, + }, + "range": Array [ + 164, + 165, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 10, + }, + "start": Object { + "column": 13, + "line": 10, + }, + }, + "range": Array [ + 165, + 166, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 14, + "line": 10, + }, + }, + "range": Array [ + 166, + 167, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 10, + }, + "start": Object { + "column": 16, + "line": 10, + }, + }, + "range": Array [ + 168, + 174, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 10, + }, + "start": Object { + "column": 22, + "line": 10, + }, + }, + "range": Array [ + 174, + 175, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "range": Array [ + 178, + 179, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 11, + }, + "start": Object { + "column": 3, + "line": 11, + }, + }, + "range": Array [ + 179, + 189, + ], + "type": "String", + "value": "'literal2'", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 11, + }, + "start": Object { + "column": 13, + "line": 11, + }, + }, + "range": Array [ + 189, + 190, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 11, + }, + "start": Object { + "column": 14, + "line": 11, + }, + }, + "range": Array [ + 190, + 191, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 11, + }, + "start": Object { + "column": 15, + "line": 11, + }, + }, + "range": Array [ + 191, + 192, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 11, + }, + "start": Object { + "column": 17, + "line": 11, + }, + }, + "range": Array [ + 193, + 199, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 11, + }, + "start": Object { + "column": 23, + "line": 11, + }, + }, + "range": Array [ + 199, + 200, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "range": Array [ + 203, + 204, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 12, + }, + "start": Object { + "column": 3, + "line": 12, + }, + }, + "range": Array [ + 204, + 205, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 12, + }, + "start": Object { + "column": 4, + "line": 12, + }, + }, + "range": Array [ + 205, + 206, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 12, + }, + "start": Object { + "column": 5, + "line": 12, + }, + }, + "range": Array [ + 206, + 207, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 12, + }, + "start": Object { + "column": 6, + "line": 12, + }, + }, + "range": Array [ + 207, + 208, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 12, + }, + "start": Object { + "column": 8, + "line": 12, + }, + }, + "range": Array [ + 209, + 215, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 12, + }, + "start": Object { + "column": 14, + "line": 12, + }, + }, + "range": Array [ + 215, + 216, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 13, + }, + }, + "range": Array [ + 217, + 218, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-property-undefined.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-property-undefined.src.ts.shot new file mode 100644 index 00000000000..531dcdad739 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-optional-property-undefined.src.ts.shot @@ -0,0 +1,340 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-optional-property-undefined.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": "private", + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 12, + 37, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "undefined", + "optional": false, + "range": Array [ + 27, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 39, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 12, + 19, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 36, + ], + "type": "Identifier", + "value": "undefined", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-override-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-override-method.src.ts.shot new file mode 100644 index 00000000000..b33f6f43641 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-override-method.src.ts.shot @@ -0,0 +1,435 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-override-method.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "show", + "optional": false, + "range": Array [ + 62, + 66, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": true, + "range": Array [ + 53, + 87, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 69, + 87, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 66, + 87, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 89, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "SpecializedComponent", + "optional": false, + "range": Array [ + 6, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 89, + ], + "superClass": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "SomeComponent", + "optional": false, + "range": Array [ + 35, + 48, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 77, + 83, + ], + "type": "Line", + "value": " ...", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 90, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 26, + ], + "type": "Identifier", + "value": "SpecializedComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 34, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 48, + ], + "type": "Identifier", + "value": "SomeComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 53, + 61, + ], + "type": "Identifier", + "value": "override", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 62, + 66, + ], + "type": "Identifier", + "value": "show", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-override-property.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-override-property.src.ts.shot new file mode 100644 index 00000000000..5fc0b57cf81 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-override-property.src.ts.shot @@ -0,0 +1,376 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-override-property.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 62, + 65, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": true, + "range": Array [ + 53, + 70, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 68, + 69, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 72, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "SpecializedComponent", + "optional": false, + "range": Array [ + 6, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 72, + ], + "superClass": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "SomeComponent", + "optional": false, + "range": Array [ + 35, + 48, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 73, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 26, + ], + "type": "Identifier", + "value": "SpecializedComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 34, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 48, + ], + "type": "Identifier", + "value": "SomeComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 53, + 61, + ], + "type": "Identifier", + "value": "override", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 62, + 65, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-private-optional-property.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-private-optional-property.src.ts.shot new file mode 100644 index 00000000000..2ce16908067 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-private-optional-property.src.ts.shot @@ -0,0 +1,709 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-private-optional-property.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "prop", + "range": Array [ + 14, + 19, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 14, + 29, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "propExplicitWithValue", + "range": Array [ + 32, + 54, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 32, + 69, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 55, + 63, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 57, + 63, + ], + "type": "TSStringKeyword", + }, + }, + "value": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 66, + 68, + ], + "raw": "''", + "type": "Literal", + "value": "", + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "propImplicitWithValue", + "range": Array [ + 72, + 94, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 72, + 101, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 98, + 100, + ], + "raw": "''", + "type": "Literal", + "value": "", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 103, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 103, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 104, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "type": "Identifier", + "value": "#prop", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 32, + 54, + ], + "type": "Identifier", + "value": "#propExplicitWithValue", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 57, + 63, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 3, + }, + "start": Object { + "column": 34, + "line": 3, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 66, + 68, + ], + "type": "String", + "value": "''", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 38, + "line": 3, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 72, + 94, + ], + "type": "Identifier", + "value": "#propImplicitWithValue", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 98, + 100, + ], + "type": "String", + "value": "''", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-private-parameter-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-private-parameter-properties.src.ts.shot new file mode 100644 index 00000000000..c85ed787d6d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-private-parameter-properties.src.ts.shot @@ -0,0 +1,1179 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-private-parameter-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 201, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 57, + "line": 5, + }, + }, + "range": Array [ + 199, + 201, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [ + Object { + "accessibility": "private", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "override": false, + "parameter": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "name": "firstName", + "optional": false, + "range": Array [ + 34, + 51, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 43, + 51, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 45, + 51, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 26, + 51, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "private", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "override": false, + "parameter": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 31, + "line": 3, + }, + }, + "name": "lastName", + "optional": false, + "range": Array [ + 84, + 100, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 92, + 100, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 41, + "line": 3, + }, + }, + "range": Array [ + 94, + 100, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 67, + 100, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "private", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "override": false, + "parameter": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 4, + }, + }, + "name": "age", + "optional": false, + "range": Array [ + 124, + 135, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 4, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 127, + 135, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 129, + 135, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 124, + 140, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 36, + "line": 4, + }, + }, + "range": Array [ + 138, + 140, + ], + "raw": "30", + "type": "Literal", + "value": 30, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + "range": Array [ + 116, + 140, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "private", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "override": false, + "parameter": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 47, + "line": 5, + }, + "start": Object { + "column": 31, + "line": 5, + }, + }, + "name": "student", + "optional": false, + "range": Array [ + 173, + 189, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "range": Array [ + 180, + 189, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 5, + }, + "start": Object { + "column": 40, + "line": 5, + }, + }, + "range": Array [ + 182, + 189, + ], + "type": "TSBooleanKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 31, + "line": 5, + }, + }, + "optional": false, + "range": Array [ + 173, + 197, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 50, + "line": 5, + }, + }, + "range": Array [ + 192, + 197, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + "range": Array [ + 156, + 197, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 25, + 201, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 203, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 203, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 203, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 26, + 33, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 34, + 43, + ], + "type": "Identifier", + "value": "firstName", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 45, + 51, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 2, + }, + "start": Object { + "column": 39, + "line": 2, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 67, + 74, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 75, + 83, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 31, + "line": 3, + }, + }, + "range": Array [ + 84, + 92, + ], + "type": "Identifier", + "value": "lastName", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 41, + "line": 3, + }, + }, + "range": Array [ + 94, + 100, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 3, + }, + "start": Object { + "column": 47, + "line": 3, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 116, + 123, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 4, + }, + }, + "range": Array [ + 124, + 127, + ], + "type": "Identifier", + "value": "age", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 25, + "line": 4, + }, + }, + "range": Array [ + 127, + 128, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 129, + 135, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 4, + }, + "start": Object { + "column": 34, + "line": 4, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 36, + "line": 4, + }, + }, + "range": Array [ + 138, + 140, + ], + "type": "Numeric", + "value": "30", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 4, + }, + "start": Object { + "column": 38, + "line": 4, + }, + }, + "range": Array [ + 140, + 141, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 156, + 163, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 164, + 172, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 5, + }, + "start": Object { + "column": 31, + "line": 5, + }, + }, + "range": Array [ + 173, + 180, + ], + "type": "Identifier", + "value": "student", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "range": Array [ + 180, + 181, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 5, + }, + "start": Object { + "column": 40, + "line": 5, + }, + }, + "range": Array [ + 182, + 189, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 48, + "line": 5, + }, + }, + "range": Array [ + 190, + 191, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 50, + "line": 5, + }, + }, + "range": Array [ + 192, + 197, + ], + "type": "Boolean", + "value": "false", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 5, + }, + "start": Object { + "column": 55, + "line": 5, + }, + }, + "range": Array [ + 197, + 198, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 5, + }, + "start": Object { + "column": 57, + "line": 5, + }, + }, + "range": Array [ + 199, + 200, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 58, + "line": 5, + }, + }, + "range": Array [ + 200, + 201, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 202, + 203, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-property-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-property-function.src.ts.shot new file mode 100644 index 00000000000..1e0af20bcff --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-property-function.src.ts.shot @@ -0,0 +1,896 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-property-function.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 55, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 17, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 19, + 32, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 22, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 25, + 32, + ], + "type": "TSBooleanKeyword", + }, + }, + "type": "TSFunctionType", + "typeParameters": undefined, + }, + }, + "value": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "range": Array [ + 50, + 54, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 35, + 54, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 37, + 46, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 39, + 46, + ], + "type": "TSBooleanKeyword", + }, + }, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 58, + 61, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 58, + 83, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 61, + 69, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 63, + 69, + ], + "type": "TSStringKeyword", + }, + }, + "value": Object { + "async": false, + "body": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "name": "test", + "optional": false, + "range": Array [ + 78, + 82, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 72, + 82, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 85, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 85, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 86, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 25, + 32, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 39, + 46, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 47, + 49, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "range": Array [ + 50, + 54, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 58, + 61, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 63, + 69, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 75, + 77, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 78, + 82, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-property-values.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-property-values.src.ts.shot new file mode 100644 index 00000000000..5c627f37a7f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-property-values.src.ts.shot @@ -0,0 +1,1204 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-property-values.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 20, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 23, + 30, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "properties": Array [], + "range": Array [ + 27, + 29, + ], + "type": "ObjectExpression", + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 33, + 40, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 37, + 39, + ], + "type": "ArrayExpression", + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "d", + "optional": false, + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 43, + 50, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 47, + 49, + ], + "raw": "\\"\\"", + "type": "Literal", + "value": "", + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "name": "e", + "optional": false, + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 53, + 80, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": Object { + "arguments": Array [ + Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "properties": Array [], + "range": Array [ + 68, + 70, + ], + "type": "ObjectExpression", + }, + Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 21, + "line": 6, + }, + }, + "range": Array [ + 72, + 74, + ], + "type": "ArrayExpression", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 25, + "line": 6, + }, + }, + "range": Array [ + 76, + 77, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 27, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 67, + 78, + ], + "type": "ArrayExpression", + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "name": "Array", + "optional": false, + "range": Array [ + 61, + 66, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 57, + 79, + ], + "type": "NewExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 82, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 82, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 83, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 47, + 49, + ], + "type": "String", + "value": "\\"\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 57, + 60, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 61, + 66, + ], + "type": "Identifier", + "value": "Array", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 15, + "line": 6, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 21, + "line": 6, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 22, + "line": 6, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 25, + "line": 6, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 6, + }, + "start": Object { + "column": 26, + "line": 6, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 6, + }, + "start": Object { + "column": 27, + "line": 6, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 6, + }, + "start": Object { + "column": 28, + "line": 6, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-protected-parameter-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-protected-parameter-properties.src.ts.shot new file mode 100644 index 00000000000..58e981f6516 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-protected-parameter-properties.src.ts.shot @@ -0,0 +1,1179 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-protected-parameter-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 61, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 209, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 61, + "line": 5, + }, + "start": Object { + "column": 59, + "line": 5, + }, + }, + "range": Array [ + 207, + 209, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 61, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [ + Object { + "accessibility": "protected", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "override": false, + "parameter": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "firstName", + "optional": false, + "range": Array [ + 36, + 53, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 45, + 53, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 47, + 53, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 26, + 53, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "protected", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "override": false, + "parameter": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "name": "lastName", + "optional": false, + "range": Array [ + 88, + 104, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 41, + "line": 3, + }, + }, + "range": Array [ + 96, + 104, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 43, + "line": 3, + }, + }, + "range": Array [ + 98, + 104, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 69, + 104, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "protected", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "override": false, + "parameter": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "name": "age", + "optional": false, + "range": Array [ + 130, + 141, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 133, + 141, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 4, + }, + "start": Object { + "column": 29, + "line": 4, + }, + }, + "range": Array [ + 135, + 141, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 130, + 146, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 38, + "line": 4, + }, + }, + "range": Array [ + 144, + 146, + ], + "raw": "30", + "type": "Literal", + "value": 30, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + "range": Array [ + 120, + 146, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "protected", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "override": false, + "parameter": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 33, + "line": 5, + }, + }, + "name": "student", + "optional": false, + "range": Array [ + 181, + 197, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 40, + "line": 5, + }, + }, + "range": Array [ + 188, + 197, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 42, + "line": 5, + }, + }, + "range": Array [ + 190, + 197, + ], + "type": "TSBooleanKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 33, + "line": 5, + }, + }, + "optional": false, + "range": Array [ + 181, + 205, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 52, + "line": 5, + }, + }, + "range": Array [ + 200, + 205, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + "range": Array [ + 162, + 205, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 25, + 209, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 211, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 211, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 211, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 26, + 35, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 36, + 45, + ], + "type": "Identifier", + "value": "firstName", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 47, + 53, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 69, + 78, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 79, + 87, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 88, + 96, + ], + "type": "Identifier", + "value": "lastName", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 41, + "line": 3, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 43, + "line": 3, + }, + }, + "range": Array [ + 98, + 104, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 3, + }, + "start": Object { + "column": 49, + "line": 3, + }, + }, + "range": Array [ + 104, + 105, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 120, + 129, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 130, + 133, + ], + "type": "Identifier", + "value": "age", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 133, + 134, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 4, + }, + "start": Object { + "column": 29, + "line": 4, + }, + }, + "range": Array [ + 135, + 141, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 4, + }, + "start": Object { + "column": 36, + "line": 4, + }, + }, + "range": Array [ + 142, + 143, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 38, + "line": 4, + }, + }, + "range": Array [ + 144, + 146, + ], + "type": "Numeric", + "value": "30", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 4, + }, + "start": Object { + "column": 40, + "line": 4, + }, + }, + "range": Array [ + 146, + 147, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 162, + 171, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 5, + }, + "start": Object { + "column": 24, + "line": 5, + }, + }, + "range": Array [ + 172, + 180, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 5, + }, + "start": Object { + "column": 33, + "line": 5, + }, + }, + "range": Array [ + 181, + 188, + ], + "type": "Identifier", + "value": "student", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 5, + }, + "start": Object { + "column": 40, + "line": 5, + }, + }, + "range": Array [ + 188, + 189, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 5, + }, + "start": Object { + "column": 42, + "line": 5, + }, + }, + "range": Array [ + 190, + 197, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 5, + }, + "start": Object { + "column": 50, + "line": 5, + }, + }, + "range": Array [ + 198, + 199, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 52, + "line": 5, + }, + }, + "range": Array [ + 200, + 205, + ], + "type": "Boolean", + "value": "false", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 5, + }, + "start": Object { + "column": 57, + "line": 5, + }, + }, + "range": Array [ + 205, + 206, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 60, + "line": 5, + }, + "start": Object { + "column": 59, + "line": 5, + }, + }, + "range": Array [ + 207, + 208, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 5, + }, + "start": Object { + "column": 60, + "line": 5, + }, + }, + "range": Array [ + 208, + 209, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 210, + 211, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-public-parameter-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-public-parameter-properties.src.ts.shot new file mode 100644 index 00000000000..cdc4474637f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-public-parameter-properties.src.ts.shot @@ -0,0 +1,1179 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-public-parameter-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 58, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 197, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 58, + "line": 5, + }, + "start": Object { + "column": 56, + "line": 5, + }, + }, + "range": Array [ + 195, + 197, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 58, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [ + Object { + "accessibility": "public", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "override": false, + "parameter": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "name": "firstName", + "optional": false, + "range": Array [ + 33, + 50, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 42, + 50, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 44, + 50, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 26, + 50, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "public", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "override": false, + "parameter": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "name": "lastName", + "optional": false, + "range": Array [ + 82, + 98, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 38, + "line": 3, + }, + }, + "range": Array [ + 90, + 98, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 40, + "line": 3, + }, + }, + "range": Array [ + 92, + 98, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 66, + 98, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "public", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 37, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "override": false, + "parameter": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "name": "age", + "optional": false, + "range": Array [ + 121, + 132, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 124, + 132, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "range": Array [ + 126, + 132, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 121, + 137, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "range": Array [ + 135, + 137, + ], + "raw": "30", + "type": "Literal", + "value": 30, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + "range": Array [ + 114, + 137, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "public", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "override": false, + "parameter": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "name": "student", + "optional": false, + "range": Array [ + 169, + 185, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 37, + "line": 5, + }, + }, + "range": Array [ + 176, + 185, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 39, + "line": 5, + }, + }, + "range": Array [ + 178, + 185, + ], + "type": "TSBooleanKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "optional": false, + "range": Array [ + 169, + 193, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 49, + "line": 5, + }, + }, + "range": Array [ + 188, + 193, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + "range": Array [ + 153, + 193, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 25, + 197, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 199, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 199, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 199, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 33, + 42, + ], + "type": "Identifier", + "value": "firstName", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 44, + 50, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 66, + 72, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 73, + 81, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 82, + 90, + ], + "type": "Identifier", + "value": "lastName", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 38, + "line": 3, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 40, + "line": 3, + }, + }, + "range": Array [ + 92, + 98, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 46, + "line": 3, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 114, + 120, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 121, + 124, + ], + "type": "Identifier", + "value": "age", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "range": Array [ + 126, + 132, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 4, + }, + "start": Object { + "column": 33, + "line": 4, + }, + }, + "range": Array [ + 133, + 134, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "range": Array [ + 135, + 137, + ], + "type": "Numeric", + "value": "30", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 37, + "line": 4, + }, + }, + "range": Array [ + 137, + 138, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 153, + 159, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 5, + }, + "start": Object { + "column": 21, + "line": 5, + }, + }, + "range": Array [ + 160, + 168, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 169, + 176, + ], + "type": "Identifier", + "value": "student", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 5, + }, + "start": Object { + "column": 37, + "line": 5, + }, + }, + "range": Array [ + 176, + 177, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 39, + "line": 5, + }, + }, + "range": Array [ + 178, + 185, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 5, + }, + "start": Object { + "column": 47, + "line": 5, + }, + }, + "range": Array [ + 186, + 187, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 49, + "line": 5, + }, + }, + "range": Array [ + 188, + 193, + ], + "type": "Boolean", + "value": "false", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 54, + "line": 5, + }, + }, + "range": Array [ + 193, + 194, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 56, + "line": 5, + }, + }, + "range": Array [ + 195, + 196, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 5, + }, + "start": Object { + "column": 57, + "line": 5, + }, + }, + "range": Array [ + 196, + 197, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 198, + 199, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-readonly-parameter-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-readonly-parameter-properties.src.ts.shot new file mode 100644 index 00000000000..af0bb502f9a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-readonly-parameter-properties.src.ts.shot @@ -0,0 +1,734 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-readonly-parameter-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 53, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 107, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 53, + "line": 3, + }, + "start": Object { + "column": 51, + "line": 3, + }, + }, + "range": Array [ + 105, + 107, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 53, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [ + Object { + "accessibility": undefined, + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 40, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "override": false, + "parameter": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 40, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "firstName", + "optional": false, + "range": Array [ + 35, + 52, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 44, + 52, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 26, + 52, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": undefined, + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "override": false, + "parameter": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "name": "lastName", + "optional": false, + "range": Array [ + 77, + 93, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 31, + "line": 3, + }, + }, + "range": Array [ + 85, + 93, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 87, + 93, + ], + "type": "TSStringKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "optional": false, + "range": Array [ + 77, + 103, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 42, + "line": 3, + }, + }, + "range": Array [ + 96, + 103, + ], + "raw": "'Smith'", + "type": "Literal", + "value": "Smith", + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + "range": Array [ + 68, + 103, + ], + "readonly": true, + "static": false, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 25, + 107, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 109, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 109, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 109, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 26, + 34, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 35, + 44, + ], + "type": "Identifier", + "value": "firstName", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 40, + "line": 2, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 68, + 76, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 77, + 85, + ], + "type": "Identifier", + "value": "lastName", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 31, + "line": 3, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 87, + 93, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 3, + }, + "start": Object { + "column": 40, + "line": 3, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 42, + "line": 3, + }, + }, + "range": Array [ + 96, + 103, + ], + "type": "String", + "value": "'Smith'", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 3, + }, + "start": Object { + "column": 49, + "line": 3, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 3, + }, + "start": Object { + "column": 51, + "line": 3, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 3, + }, + "start": Object { + "column": 52, + "line": 3, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-readonly-property.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-readonly-property.src.ts.shot new file mode 100644 index 00000000000..e1cb3027f48 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-readonly-property.src.ts.shot @@ -0,0 +1,338 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-readonly-property.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": "public", + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 16, + 47, + ], + "readonly": true, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 46, + ], + "raw": "'string'", + "type": "Literal", + "value": "string", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 49, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 23, + 31, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 46, + ], + "type": "String", + "value": "'string'", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-static-parameter-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-static-parameter-properties.src.ts.shot new file mode 100644 index 00000000000..3967ac7a6c0 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-static-parameter-properties.src.ts.shot @@ -0,0 +1,492 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-static-parameter-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 16, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 16, + 54, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 54, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "accessibility": undefined, + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "override": false, + "parameter": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 35, + 44, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 36, + 44, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "TSStringKeyword", + }, + }, + }, + "range": Array [ + 28, + 44, + ], + "readonly": false, + "static": true, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 27, + 54, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 56, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 59, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 27, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 34, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-two-methods-computed-constructor.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-two-methods-computed-constructor.src.ts.shot new file mode 100644 index 00000000000..b98697aa054 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-two-methods-computed-constructor.src.ts.shot @@ -0,0 +1,954 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-two-methods-computed-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 12, + 25, + ], + "raw": "\\"constructor\\"", + "type": "Literal", + "value": "constructor", + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 12, + 44, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 39, + 44, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 25, + 44, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 26, + 27, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 25, + 28, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + }, + Object { + "accessibility": undefined, + "computed": true, + "decorators": Array [], + "key": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 49, + 62, + ], + "raw": "\\"constructor\\"", + "type": "Literal", + "value": "constructor", + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 48, + 82, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 31, + "line": 5, + }, + }, + "range": Array [ + 77, + 82, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "params": Array [], + "range": Array [ + 63, + 82, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 68, + 76, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 5, + }, + "start": Object { + "column": 24, + "line": 5, + }, + }, + "range": Array [ + 70, + 76, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 64, + 65, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 64, + 65, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 63, + 66, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 84, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 84, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "EmptyStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 86, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 12, + 25, + ], + "type": "String", + "value": "\\"constructor\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 49, + 62, + ], + "type": "String", + "value": "\\"constructor\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 21, + "line": 5, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 5, + }, + "start": Object { + "column": 24, + "line": 5, + }, + }, + "range": Array [ + 70, + 76, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 5, + }, + "start": Object { + "column": 31, + "line": 5, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 7, + }, + "start": Object { + "column": 1, + "line": 7, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-type-parameter-default.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-type-parameter-default.src.ts.shot new file mode 100644 index 00000000000..579cd3a2533 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-type-parameter-default.src.ts.shot @@ -0,0 +1,350 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-type-parameter-default.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "Bar", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "in": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 10, + 17, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 9, + 18, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-type-parameter-underscore.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-type-parameter-underscore.src.ts.shot new file mode 100644 index 00000000000..ee2092ed3b5 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-type-parameter-underscore.src.ts.shot @@ -0,0 +1,276 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-type-parameter-underscore.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "__P", + "optional": false, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 8, + 11, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 7, + 12, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Identifier", + "value": "__P", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-type-parameter.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-type-parameter.src.ts.shot new file mode 100644 index 00000000000..d59966b5d8d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-type-parameter.src.ts.shot @@ -0,0 +1,276 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics class-with-type-parameter.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 17, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 10, + 11, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 9, + 12, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/const-assertions.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/const-assertions.src.ts.shot new file mode 100644 index 00000000000..d4d46d09c25 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/const-assertions.src.ts.shot @@ -0,0 +1,2244 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics const-assertions.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 21, + 23, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 21, + 32, + ], + "type": "TSAsExpression", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 27, + 32, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "const", + "optional": false, + "range": Array [ + 27, + 32, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 32, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 13, + 33, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 67, + 68, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "expression": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 72, + 74, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 76, + 78, + ], + "raw": "20", + "type": "Literal", + "value": 20, + }, + ], + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 71, + 79, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 71, + 88, + ], + "type": "TSAsExpression", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 83, + 88, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "name": "const", + "optional": false, + "range": Array [ + 83, + 88, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 67, + 88, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 63, + 89, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 132, + 133, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 8, + }, + }, + "name": "text", + "optional": false, + "range": Array [ + 138, + 142, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 23, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 8, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 138, + 151, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 8, + }, + "start": Object { + "column": 16, + "line": 8, + }, + }, + "range": Array [ + 144, + 151, + ], + "raw": "\\"hello\\"", + "type": "Literal", + "value": "hello", + }, + }, + ], + "range": Array [ + 136, + 153, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 136, + 162, + ], + "type": "TSAsExpression", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 8, + }, + "start": Object { + "column": 29, + "line": 8, + }, + }, + "range": Array [ + 157, + 162, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 8, + }, + "start": Object { + "column": 29, + "line": 8, + }, + }, + "name": "const", + "optional": false, + "range": Array [ + 157, + 162, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 132, + 162, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 35, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 128, + 163, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 182, + 183, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 15, + "line": 11, + }, + }, + "range": Array [ + 193, + 195, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 8, + "line": 11, + }, + }, + "range": Array [ + 186, + 195, + ], + "type": "TSTypeAssertion", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 11, + }, + "start": Object { + "column": 9, + "line": 11, + }, + }, + "range": Array [ + 187, + 192, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 11, + }, + "start": Object { + "column": 9, + "line": 11, + }, + }, + "name": "const", + "optional": false, + "range": Array [ + 187, + 192, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "range": Array [ + 182, + 195, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 18, + "line": 11, + }, + "start": Object { + "column": 0, + "line": 11, + }, + }, + "range": Array [ + 178, + 196, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 230, + 231, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "expression": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 14, + }, + "start": Object { + "column": 16, + "line": 14, + }, + }, + "range": Array [ + 242, + 244, + ], + "raw": "10", + "type": "Literal", + "value": 10, + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 14, + }, + "start": Object { + "column": 20, + "line": 14, + }, + }, + "range": Array [ + 246, + 248, + ], + "raw": "20", + "type": "Literal", + "value": 20, + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 14, + }, + "start": Object { + "column": 15, + "line": 14, + }, + }, + "range": Array [ + 241, + 249, + ], + "type": "ArrayExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 14, + }, + "start": Object { + "column": 8, + "line": 14, + }, + }, + "range": Array [ + 234, + 249, + ], + "type": "TSTypeAssertion", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 14, + }, + "start": Object { + "column": 9, + "line": 14, + }, + }, + "range": Array [ + 235, + 240, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 14, + }, + "start": Object { + "column": 9, + "line": 14, + }, + }, + "name": "const", + "optional": false, + "range": Array [ + 235, + 240, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "range": Array [ + 230, + 249, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 24, + "line": 14, + }, + "start": Object { + "column": 0, + "line": 14, + }, + }, + "range": Array [ + 226, + 250, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 17, + }, + "start": Object { + "column": 4, + "line": 17, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 293, + 294, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 17, + }, + "start": Object { + "column": 15, + "line": 17, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 17, + }, + "start": Object { + "column": 17, + "line": 17, + }, + }, + "name": "text", + "optional": false, + "range": Array [ + 306, + 310, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 30, + "line": 17, + }, + "start": Object { + "column": 17, + "line": 17, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 306, + 319, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 17, + }, + "start": Object { + "column": 23, + "line": 17, + }, + }, + "range": Array [ + 312, + 319, + ], + "raw": "\\"hello\\"", + "type": "Literal", + "value": "hello", + }, + }, + ], + "range": Array [ + 304, + 321, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 17, + }, + "start": Object { + "column": 8, + "line": 17, + }, + }, + "range": Array [ + 297, + 321, + ], + "type": "TSTypeAssertion", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 17, + }, + "start": Object { + "column": 9, + "line": 17, + }, + }, + "range": Array [ + 298, + 303, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 17, + }, + "start": Object { + "column": 9, + "line": 17, + }, + }, + "name": "const", + "optional": false, + "range": Array [ + 298, + 303, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 17, + }, + "start": Object { + "column": 4, + "line": 17, + }, + }, + "range": Array [ + 293, + 321, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 33, + "line": 17, + }, + "start": Object { + "column": 0, + "line": 17, + }, + }, + "range": Array [ + 289, + 322, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "Line", + "value": " Type '10'", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 35, + 62, + ], + "type": "Line", + "value": " Type 'readonly [10, 20]'", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 91, + 127, + ], + "type": "Line", + "value": " Type '{ readonly text: \\"hello\\" }'", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 10, + }, + }, + "range": Array [ + 165, + 177, + ], + "type": "Line", + "value": " Type '10'", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 13, + }, + }, + "range": Array [ + 198, + 225, + ], + "type": "Line", + "value": " Type 'readonly [10, 20]'", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 16, + }, + "start": Object { + "column": 0, + "line": 16, + }, + }, + "range": Array [ + 252, + 288, + ], + "type": "Line", + "value": " Type '{ readonly text: \\"hello\\" }'", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 18, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 13, + 323, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 27, + 32, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 63, + 66, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 72, + 74, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 76, + 78, + ], + "type": "Numeric", + "value": "20", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 80, + 82, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 83, + 88, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 25, + "line": 5, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 128, + 131, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 8, + }, + }, + "range": Array [ + 134, + 135, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 8, + }, + }, + "range": Array [ + 138, + 142, + ], + "type": "Identifier", + "value": "text", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 14, + "line": 8, + }, + }, + "range": Array [ + 142, + 143, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 8, + }, + "start": Object { + "column": 16, + "line": 8, + }, + }, + "range": Array [ + 144, + 151, + ], + "type": "String", + "value": "\\"hello\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 8, + }, + "start": Object { + "column": 24, + "line": 8, + }, + }, + "range": Array [ + 152, + 153, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 8, + }, + "start": Object { + "column": 26, + "line": 8, + }, + }, + "range": Array [ + 154, + 156, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 8, + }, + "start": Object { + "column": 29, + "line": 8, + }, + }, + "range": Array [ + 157, + 162, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 8, + }, + "start": Object { + "column": 34, + "line": 8, + }, + }, + "range": Array [ + 162, + 163, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 11, + }, + "start": Object { + "column": 0, + "line": 11, + }, + }, + "range": Array [ + 178, + 181, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "range": Array [ + 182, + 183, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 11, + }, + "start": Object { + "column": 6, + "line": 11, + }, + }, + "range": Array [ + 184, + 185, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 11, + }, + "start": Object { + "column": 8, + "line": 11, + }, + }, + "range": Array [ + 186, + 187, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 11, + }, + "start": Object { + "column": 9, + "line": 11, + }, + }, + "range": Array [ + 187, + 192, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 11, + }, + "start": Object { + "column": 14, + "line": 11, + }, + }, + "range": Array [ + 192, + 193, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 15, + "line": 11, + }, + }, + "range": Array [ + 193, + 195, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 11, + }, + "start": Object { + "column": 17, + "line": 11, + }, + }, + "range": Array [ + 195, + 196, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 14, + }, + "start": Object { + "column": 0, + "line": 14, + }, + }, + "range": Array [ + 226, + 229, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "range": Array [ + 230, + 231, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 14, + }, + "start": Object { + "column": 6, + "line": 14, + }, + }, + "range": Array [ + 232, + 233, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 14, + }, + "start": Object { + "column": 8, + "line": 14, + }, + }, + "range": Array [ + 234, + 235, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 14, + }, + "start": Object { + "column": 9, + "line": 14, + }, + }, + "range": Array [ + 235, + 240, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 14, + }, + "start": Object { + "column": 14, + "line": 14, + }, + }, + "range": Array [ + 240, + 241, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 14, + }, + "start": Object { + "column": 15, + "line": 14, + }, + }, + "range": Array [ + 241, + 242, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 14, + }, + "start": Object { + "column": 16, + "line": 14, + }, + }, + "range": Array [ + 242, + 244, + ], + "type": "Numeric", + "value": "10", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 14, + }, + "start": Object { + "column": 18, + "line": 14, + }, + }, + "range": Array [ + 244, + 245, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 14, + }, + "start": Object { + "column": 20, + "line": 14, + }, + }, + "range": Array [ + 246, + 248, + ], + "type": "Numeric", + "value": "20", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 14, + }, + "start": Object { + "column": 22, + "line": 14, + }, + }, + "range": Array [ + 248, + 249, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 14, + }, + "start": Object { + "column": 23, + "line": 14, + }, + }, + "range": Array [ + 249, + 250, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 17, + }, + "start": Object { + "column": 0, + "line": 17, + }, + }, + "range": Array [ + 289, + 292, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 17, + }, + "start": Object { + "column": 4, + "line": 17, + }, + }, + "range": Array [ + 293, + 294, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 17, + }, + "start": Object { + "column": 6, + "line": 17, + }, + }, + "range": Array [ + 295, + 296, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 17, + }, + "start": Object { + "column": 8, + "line": 17, + }, + }, + "range": Array [ + 297, + 298, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 17, + }, + "start": Object { + "column": 9, + "line": 17, + }, + }, + "range": Array [ + 298, + 303, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 17, + }, + "start": Object { + "column": 14, + "line": 17, + }, + }, + "range": Array [ + 303, + 304, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 17, + }, + "start": Object { + "column": 15, + "line": 17, + }, + }, + "range": Array [ + 304, + 305, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 17, + }, + "start": Object { + "column": 17, + "line": 17, + }, + }, + "range": Array [ + 306, + 310, + ], + "type": "Identifier", + "value": "text", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 17, + }, + "start": Object { + "column": 21, + "line": 17, + }, + }, + "range": Array [ + 310, + 311, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 17, + }, + "start": Object { + "column": 23, + "line": 17, + }, + }, + "range": Array [ + 312, + 319, + ], + "type": "String", + "value": "\\"hello\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 17, + }, + "start": Object { + "column": 31, + "line": 17, + }, + }, + "range": Array [ + 320, + 321, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 17, + }, + "start": Object { + "column": 32, + "line": 17, + }, + }, + "range": Array [ + 321, + 322, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/const-enum.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/const-enum.src.ts.shot new file mode 100644 index 00000000000..678e60a81ea --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/const-enum.src.ts.shot @@ -0,0 +1,347 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics const-enum.src 1`] = ` +Object { + "body": Array [ + Object { + "const": true, + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "members": Array [ + Object { + "computed": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "initializer": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 28, + ], + "type": "TSEnumMember", + }, + Object { + "computed": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "initializer": undefined, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "TSEnumMember", + }, + ], + "range": Array [ + 0, + 39, + ], + "type": "TSEnumDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 10, + ], + "type": "Keyword", + "value": "enum", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/declare-class-with-optional-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/declare-class-with-optional-method.src.ts.shot new file mode 100644 index 00000000000..b9f3475ad29 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/declare-class-with-optional-method.src.ts.shot @@ -0,0 +1,412 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics declare-class-with-optional-method.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": true, + "override": false, + "range": Array [ + 24, + 36, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": null, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 28, + 36, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 30, + 35, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "TSAnyKeyword", + }, + }, + "type": "TSEmptyBodyFunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 38, + ], + "type": "ClassBody", + }, + "declare": true, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 13, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/declare-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/declare-function.src.ts.shot new file mode 100644 index 00000000000..43bbd37c22b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/declare-function.src.ts.shot @@ -0,0 +1,359 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics declare-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": undefined, + "declare": true, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 21, + 32, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 42, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 41, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "TSStringKeyword", + }, + }, + "type": "TSDeclareFunction", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 16, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment-nested.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment-nested.src.ts.shot new file mode 100644 index 00000000000..ec9805e06bb --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment-nested.src.ts.shot @@ -0,0 +1,2303 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics destructuring-assignment-nested.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 81, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 3, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 79, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 3, + 79, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 73, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 71, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 10, + 71, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 66, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 17, + 64, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 28, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 28, + 42, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 33, + 36, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 33, + 42, + ], + "right": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "ArrayExpression", + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 26, + 44, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 58, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 26, + 58, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 49, + 52, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 57, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 49, + 57, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 55, + "line": 1, + }, + }, + "range": Array [ + 55, + 56, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + ], + "loc": Object { + "end": Object { + "column": 57, + "line": 1, + }, + "start": Object { + "column": 54, + "line": 1, + }, + }, + "range": Array [ + 54, + 57, + ], + "type": "ArrayExpression", + }, + }, + ], + "range": Array [ + 47, + 58, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 59, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 22, + 59, + ], + "type": "ArrayPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 22, + 64, + ], + "right": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 64, + ], + "type": "ArrayExpression", + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 15, + 66, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 71, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 15, + 71, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 1, + }, + "start": Object { + "column": 69, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 69, + 71, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 8, + 73, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 79, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 8, + 79, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 1, + }, + "start": Object { + "column": 76, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 76, + 79, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 1, + 81, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 127, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 1, + 127, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 127, + "line": 1, + }, + "start": Object { + "column": 84, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 89, + "line": 1, + }, + "start": Object { + "column": 86, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 86, + 89, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 126, + "line": 1, + }, + "start": Object { + "column": 86, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 86, + 126, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 126, + "line": 1, + }, + "start": Object { + "column": 91, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 96, + "line": 1, + }, + "start": Object { + "column": 93, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 93, + 96, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 124, + "line": 1, + }, + "start": Object { + "column": 93, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 93, + 124, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 124, + "line": 1, + }, + "start": Object { + "column": 98, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 103, + "line": 1, + }, + "start": Object { + "column": 100, + "line": 1, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 100, + 103, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 122, + "line": 1, + }, + "start": Object { + "column": 100, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 100, + 122, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 107, + "line": 1, + }, + "start": Object { + "column": 106, + "line": 1, + }, + }, + "range": Array [ + 106, + 107, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + Object { + "loc": Object { + "end": Object { + "column": 121, + "line": 1, + }, + "start": Object { + "column": 109, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 114, + "line": 1, + }, + "start": Object { + "column": 111, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 111, + 114, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 119, + "line": 1, + }, + "start": Object { + "column": 111, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 111, + 119, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "elements": Array [ + Object { + "loc": Object { + "end": Object { + "column": 118, + "line": 1, + }, + "start": Object { + "column": 117, + "line": 1, + }, + }, + "range": Array [ + 117, + 118, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + ], + "loc": Object { + "end": Object { + "column": 119, + "line": 1, + }, + "start": Object { + "column": 116, + "line": 1, + }, + }, + "range": Array [ + 116, + 119, + ], + "type": "ArrayExpression", + }, + }, + ], + "range": Array [ + 109, + 121, + ], + "type": "ObjectExpression", + }, + ], + "loc": Object { + "end": Object { + "column": 122, + "line": 1, + }, + "start": Object { + "column": 105, + "line": 1, + }, + }, + "range": Array [ + 105, + 122, + ], + "type": "ArrayExpression", + }, + }, + ], + "range": Array [ + 98, + 124, + ], + "type": "ObjectExpression", + }, + }, + ], + "range": Array [ + 91, + 126, + ], + "type": "ObjectExpression", + }, + }, + ], + "range": Array [ + 84, + 127, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 129, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 129, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 130, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 6, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 52, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 52, + "line": 1, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 54, + "line": 1, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 55, + "line": 1, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 1, + }, + "start": Object { + "column": 56, + "line": 1, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 1, + }, + "start": Object { + "column": 57, + "line": 1, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 1, + }, + "start": Object { + "column": 58, + "line": 1, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 1, + }, + "start": Object { + "column": 60, + "line": 1, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 63, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 63, + "line": 1, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 66, + "line": 1, + }, + "start": Object { + "column": 65, + "line": 1, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 67, + "line": 1, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 70, + "line": 1, + }, + "start": Object { + "column": 69, + "line": 1, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 1, + }, + "start": Object { + "column": 70, + "line": 1, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 1, + }, + "start": Object { + "column": 72, + "line": 1, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 75, + "line": 1, + }, + "start": Object { + "column": 74, + "line": 1, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 76, + "line": 1, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 1, + }, + "start": Object { + "column": 78, + "line": 1, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 81, + "line": 1, + }, + "start": Object { + "column": 80, + "line": 1, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 83, + "line": 1, + }, + "start": Object { + "column": 82, + "line": 1, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 85, + "line": 1, + }, + "start": Object { + "column": 84, + "line": 1, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 89, + "line": 1, + }, + "start": Object { + "column": 86, + "line": 1, + }, + }, + "range": Array [ + 86, + 89, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 90, + "line": 1, + }, + "start": Object { + "column": 89, + "line": 1, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 92, + "line": 1, + }, + "start": Object { + "column": 91, + "line": 1, + }, + }, + "range": Array [ + 91, + 92, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 96, + "line": 1, + }, + "start": Object { + "column": 93, + "line": 1, + }, + }, + "range": Array [ + 93, + 96, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 97, + "line": 1, + }, + "start": Object { + "column": 96, + "line": 1, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 99, + "line": 1, + }, + "start": Object { + "column": 98, + "line": 1, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 103, + "line": 1, + }, + "start": Object { + "column": 100, + "line": 1, + }, + }, + "range": Array [ + 100, + 103, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 104, + "line": 1, + }, + "start": Object { + "column": 103, + "line": 1, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 106, + "line": 1, + }, + "start": Object { + "column": 105, + "line": 1, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 107, + "line": 1, + }, + "start": Object { + "column": 106, + "line": 1, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 108, + "line": 1, + }, + "start": Object { + "column": 107, + "line": 1, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 110, + "line": 1, + }, + "start": Object { + "column": 109, + "line": 1, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 114, + "line": 1, + }, + "start": Object { + "column": 111, + "line": 1, + }, + }, + "range": Array [ + 111, + 114, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 115, + "line": 1, + }, + "start": Object { + "column": 114, + "line": 1, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 117, + "line": 1, + }, + "start": Object { + "column": 116, + "line": 1, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 118, + "line": 1, + }, + "start": Object { + "column": 117, + "line": 1, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 119, + "line": 1, + }, + "start": Object { + "column": 118, + "line": 1, + }, + }, + "range": Array [ + 118, + 119, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 121, + "line": 1, + }, + "start": Object { + "column": 120, + "line": 1, + }, + }, + "range": Array [ + 120, + 121, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 122, + "line": 1, + }, + "start": Object { + "column": 121, + "line": 1, + }, + }, + "range": Array [ + 121, + 122, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 124, + "line": 1, + }, + "start": Object { + "column": 123, + "line": 1, + }, + }, + "range": Array [ + 123, + 124, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 126, + "line": 1, + }, + "start": Object { + "column": 125, + "line": 1, + }, + }, + "range": Array [ + 125, + 126, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 127, + "line": 1, + }, + "start": Object { + "column": 126, + "line": 1, + }, + }, + "range": Array [ + 126, + 127, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 128, + "line": 1, + }, + "start": Object { + "column": 127, + "line": 1, + }, + }, + "range": Array [ + 127, + 128, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 129, + "line": 1, + }, + "start": Object { + "column": 128, + "line": 1, + }, + }, + "range": Array [ + 128, + 129, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment-object.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment-object.src.ts.shot new file mode 100644 index 00000000000..cee6ef4b9dc --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment-object.src.ts.shot @@ -0,0 +1,406 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics destructuring-assignment-object.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 3, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 3, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 3, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 3, + 11, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 9, + 11, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 1, + 13, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 1, + 19, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 6, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment-property.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment-property.src.ts.shot new file mode 100644 index 00000000000..826e02c3a47 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment-property.src.ts.shot @@ -0,0 +1,508 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics destructuring-assignment-property.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 37, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 15, + 23, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 15, + 23, + ], + "right": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "ArrayExpression", + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 13, + 25, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 13, + 31, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 28, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 37, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment.src.ts.shot new file mode 100644 index 00000000000..88aa09dc410 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/destructuring-assignment.src.ts.shot @@ -0,0 +1,406 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics destructuring-assignment.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 3, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 3, + 11, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 3, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 3, + 11, + ], + "right": Object { + "elements": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "ArrayExpression", + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 1, + 13, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 1, + 19, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 6, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/directive-in-module.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/directive-in-module.src.ts.shot new file mode 100644 index 00000000000..2eb6fecd04b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/directive-in-module.src.ts.shot @@ -0,0 +1,473 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics directive-in-module.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 15, + 27, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 15, + 28, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 39, + 40, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 35, + 40, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 31, + 41, + ], + "type": "VariableDeclaration", + }, + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 44, + 56, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 44, + 57, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 59, + ], + "type": "TSModuleBlock", + }, + "declare": false, + "global": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 59, + ], + "type": "TSModuleDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 60, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 15, + 27, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 44, + 56, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/directive-in-namespace.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/directive-in-namespace.src.ts.shot new file mode 100644 index 00000000000..ca335e16698 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/directive-in-namespace.src.ts.shot @@ -0,0 +1,473 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics directive-in-namespace.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "directive": "use strict", + "expression": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 30, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 31, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 38, + 43, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 34, + 44, + ], + "type": "VariableDeclaration", + }, + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 47, + 59, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 47, + 60, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 62, + ], + "type": "TSModuleBlock", + }, + "declare": false, + "global": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 62, + ], + "type": "TSModuleDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 63, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Identifier", + "value": "namespace", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 30, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 47, + 59, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/dynamic-import-with-import-assertions.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/dynamic-import-with-import-assertions.src.ts.shot new file mode 100644 index 00000000000..3df92c53024 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/dynamic-import-with-import-assertions.src.ts.shot @@ -0,0 +1,494 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics dynamic-import-with-import-assertions.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "attributes": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "assert", + "optional": false, + "range": Array [ + 16, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 16, + 40, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "type", + "optional": false, + "range": Array [ + 26, + 30, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 26, + 38, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "raw": "\\"json\\"", + "type": "Literal", + "value": "json", + }, + }, + ], + "range": Array [ + 24, + 40, + ], + "type": "ObjectExpression", + }, + }, + ], + "range": Array [ + 14, + 42, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "type": "ImportExpression", + }, + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Identifier", + "value": "assert", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 30, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "String", + "value": "\\"json\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-all-with-import-assertions.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-all-with-import-assertions.src.ts.shot new file mode 100644 index 00000000000..c0a1ebe8438 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-all-with-import-assertions.src.ts.shot @@ -0,0 +1,322 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics export-all-with-import-assertions.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [ + Object { + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "type", + "optional": false, + "range": Array [ + 29, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 41, + ], + "type": "ImportAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "raw": "\\"json\\"", + "type": "Literal", + "value": "json", + }, + }, + ], + "exportKind": "value", + "exported": null, + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 19, + ], + "raw": "\\"mod\\"", + "type": "Literal", + "value": "mod", + }, + "type": "ExportAllDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 19, + ], + "type": "String", + "value": "\\"mod\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 26, + ], + "type": "Identifier", + "value": "assert", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 33, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "String", + "value": "\\"json\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-as-namespace.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-as-namespace.src.ts.shot new file mode 100644 index 00000000000..762447f79f6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-as-namespace.src.ts.shot @@ -0,0 +1,155 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics export-as-namespace.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "type": "TSNamespaceExportDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 19, + ], + "type": "Identifier", + "value": "namespace", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-assignment.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-assignment.src.ts.shot new file mode 100644 index 00000000000..e32083119d8 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-assignment.src.ts.shot @@ -0,0 +1,137 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics export-assignment.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "TSExportAssignment", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-declare-const-named-enum.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-declare-const-named-enum.src.ts.shot new file mode 100644 index 00000000000..6b8c64ddcae --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-declare-const-named-enum.src.ts.shot @@ -0,0 +1,404 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics export-declare-const-named-enum.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "const": true, + "declare": true, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "members": Array [ + Object { + "computed": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 36, + 39, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "initializer": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 36, + 43, + ], + "type": "TSEnumMember", + }, + Object { + "computed": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 49, + 52, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "initializer": undefined, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 49, + 52, + ], + "type": "TSEnumMember", + }, + ], + "range": Array [ + 7, + 54, + ], + "type": "TSEnumDeclaration", + }, + "exportKind": "type", + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 54, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 55, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 25, + ], + "type": "Keyword", + "value": "enum", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 36, + 39, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 49, + 52, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-declare-named-enum.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-declare-named-enum.src.ts.shot new file mode 100644 index 00000000000..01a33397137 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-declare-named-enum.src.ts.shot @@ -0,0 +1,386 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics export-declare-named-enum.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "const": false, + "declare": true, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "members": Array [ + Object { + "computed": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 30, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "initializer": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 30, + 37, + ], + "type": "TSEnumMember", + }, + Object { + "computed": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 43, + 46, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "initializer": undefined, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 43, + 46, + ], + "type": "TSEnumMember", + }, + ], + "range": Array [ + 7, + 48, + ], + "type": "TSEnumDeclaration", + }, + "exportKind": "type", + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 19, + ], + "type": "Keyword", + "value": "enum", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 30, + 33, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 43, + 46, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-default-class-with-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-default-class-with-generic.src.ts.shot new file mode 100644 index 00000000000..5ffbcb3602d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-default-class-with-generic.src.ts.shot @@ -0,0 +1,292 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics export-default-class-with-generic.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 28, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": null, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 28, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 21, + 22, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 20, + 23, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-default-class-with-multiple-generics.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-default-class-with-multiple-generics.src.ts.shot new file mode 100644 index 00000000000..da88cdb4430 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-default-class-with-multiple-generics.src.ts.shot @@ -0,0 +1,370 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics export-default-class-with-multiple-generics.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 31, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": null, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 31, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 21, + 22, + ], + "type": "TSTypeParameter", + }, + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 24, + 25, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 20, + 26, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-default-interface.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-default-interface.src.ts.shot new file mode 100644 index 00000000000..62ff5e71b50 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-default-interface.src.ts.shot @@ -0,0 +1,402 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics export-default-interface.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "method1", + "optional": false, + "range": Array [ + 31, + 38, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "params": Array [], + "range": Array [ + 31, + 47, + ], + "readonly": false, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 42, + 46, + ], + "type": "TSVoidKeyword", + }, + }, + "static": false, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 49, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 49, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 24, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "Identifier", + "value": "method1", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 42, + 46, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-class-with-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-class-with-generic.src.ts.shot new file mode 100644 index 00000000000..d907ed8d584 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-class-with-generic.src.ts.shot @@ -0,0 +1,315 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics export-named-class-with-generic.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 24, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 24, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 17, + 18, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 16, + 19, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-class-with-multiple-generics.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-class-with-multiple-generics.src.ts.shot new file mode 100644 index 00000000000..0aa3eb70821 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-class-with-multiple-generics.src.ts.shot @@ -0,0 +1,393 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics export-named-class-with-multiple-generics.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 27, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 27, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 17, + 18, + ], + "type": "TSTypeParameter", + }, + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 20, + 21, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 16, + 22, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum-computed-number.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum-computed-number.src.ts.shot new file mode 100644 index 00000000000..6f44a4685e2 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum-computed-number.src.ts.shot @@ -0,0 +1,290 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics export-named-enum-computed-number.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "const": false, + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "members": Array [ + Object { + "computed": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "initializer": undefined, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "TSEnumMember", + }, + ], + "range": Array [ + 7, + 28, + ], + "type": "TSEnumDeclaration", + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Keyword", + "value": "enum", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum-computed-string.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum-computed-string.src.ts.shot new file mode 100644 index 00000000000..45f6879979c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum-computed-string.src.ts.shot @@ -0,0 +1,290 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics export-named-enum-computed-string.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "const": false, + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "members": Array [ + Object { + "computed": true, + "id": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 23, + 28, + ], + "raw": "'baz'", + "type": "Literal", + "value": "baz", + }, + "initializer": undefined, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 29, + ], + "type": "TSEnumMember", + }, + ], + "range": Array [ + 7, + 32, + ], + "type": "TSEnumDeclaration", + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Keyword", + "value": "enum", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 23, + 28, + ], + "type": "String", + "value": "'baz'", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum-computed-var-ref.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum-computed-var-ref.src.ts.shot new file mode 100644 index 00000000000..15f9ab6adcb --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum-computed-var-ref.src.ts.shot @@ -0,0 +1,292 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics export-named-enum-computed-var-ref.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "const": false, + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "members": Array [ + Object { + "computed": true, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "initializer": undefined, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "TSEnumMember", + }, + ], + "range": Array [ + 7, + 28, + ], + "type": "TSEnumDeclaration", + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Keyword", + "value": "enum", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum.src.ts.shot new file mode 100644 index 00000000000..2ba70f6dbfc --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-enum.src.ts.shot @@ -0,0 +1,368 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics export-named-enum.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "const": false, + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "members": Array [ + Object { + "computed": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "initializer": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 29, + ], + "type": "TSEnumMember", + }, + Object { + "computed": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "initializer": undefined, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "TSEnumMember", + }, + ], + "range": Array [ + 7, + 40, + ], + "type": "TSEnumDeclaration", + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Keyword", + "value": "enum", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-star-as-ns-from.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-star-as-ns-from.src.ts.shot new file mode 100644 index 00000000000..d2e375c0d85 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-star-as-ns-from.src.ts.shot @@ -0,0 +1,212 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics export-star-as-ns-from.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 26, + ], + "raw": "'bar'", + "type": "Literal", + "value": "bar", + }, + "type": "ExportAllDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 26, + ], + "type": "String", + "value": "'bar'", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-as.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-as.src.ts.shot new file mode 100644 index 00000000000..6ff8663ab0d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-as.src.ts.shot @@ -0,0 +1,254 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics export-type-as.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": null, + "exportKind": "type", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "source": null, + "specifiers": Array [ + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "B", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 14, + 20, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-from-as.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-from-as.src.ts.shot new file mode 100644 index 00000000000..bbc8ed36a35 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-from-as.src.ts.shot @@ -0,0 +1,308 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics export-type-from-as.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": null, + "exportKind": "type", + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 33, + ], + "raw": "'./a'", + "type": "Literal", + "value": "./a", + }, + "specifiers": Array [ + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "C", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "B", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 14, + 20, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 27, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 33, + ], + "type": "String", + "value": "'./a'", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-from.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-from.src.ts.shot new file mode 100644 index 00000000000..cc28ae28863 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-type-from.src.ts.shot @@ -0,0 +1,272 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics export-type-from.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": null, + "exportKind": "type", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 30, + ], + "raw": "'bar'", + "type": "Literal", + "value": "bar", + }, + "specifiers": Array [ + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 14, + 17, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 24, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 30, + ], + "type": "String", + "value": "'bar'", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-type.src.ts.shot new file mode 100644 index 00000000000..9d2e60e63f3 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-type.src.ts.shot @@ -0,0 +1,218 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics export-type.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": null, + "exportKind": "type", + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "source": null, + "specifiers": Array [ + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 14, + 17, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-with-import-assertions.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-with-import-assertions.src.ts.shot new file mode 100644 index 00000000000..0899fc9e971 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-with-import-assertions.src.ts.shot @@ -0,0 +1,420 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics export-with-import-assertions.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [ + Object { + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "type", + "optional": false, + "range": Array [ + 35, + 39, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 47, + ], + "type": "ImportAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 47, + ], + "raw": "\\"json\\"", + "type": "Literal", + "value": "json", + }, + }, + ], + "declaration": null, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 25, + ], + "raw": "\\"mod\\"", + "type": "Literal", + "value": "mod", + }, + "specifiers": Array [ + Object { + "exportKind": "value", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 9, + 12, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 25, + ], + "type": "String", + "value": "\\"mod\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "Identifier", + "value": "assert", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 39, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 47, + ], + "type": "String", + "value": "\\"json\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 1, + }, + "start": Object { + "column": 48, + "line": 1, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-anonymus-with-type-parameters.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-anonymus-with-type-parameters.src.ts.shot new file mode 100644 index 00000000000..4aecf98d26d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-anonymus-with-type-parameters.src.ts.shot @@ -0,0 +1,608 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics function-anonymus-with-type-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "obj", + "optional": false, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 38, + 47, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 49, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 23, + 32, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 10, + 49, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 20, + 21, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 19, + 22, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 49, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "obj", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 18, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-anynomus-with-return-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-anynomus-with-return-type.src.ts.shot new file mode 100644 index 00000000000..c315d367f84 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-anynomus-with-return-type.src.ts.shot @@ -0,0 +1,361 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics function-anynomus-with-return-type.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "obj", + "optional": false, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 31, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 10, + 31, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 27, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 31, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 2, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "obj", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 18, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 27, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-overloads.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-overloads.src.ts.shot new file mode 100644 index 00000000000..0d2e375cd3e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-overloads.src.ts.shot @@ -0,0 +1,1358 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics function-overloads.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "async": false, + "body": undefined, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 18, + 27, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 27, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 7, + 37, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 36, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "TSDeclareFunction", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + Object { + "assertions": Array [], + "declaration": Object { + "async": false, + "body": undefined, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 54, + 55, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 56, + 65, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 57, + 65, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 59, + 65, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 45, + 75, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 66, + 74, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "TSStringKeyword", + }, + }, + "type": "TSDeclareFunction", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 38, + 75, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + Object { + "assertions": Array [], + "declaration": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 142, + 143, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 135, + 144, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 55, + "line": 3, + }, + }, + "range": Array [ + 131, + 146, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 94, + 112, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 95, + 112, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 97, + 112, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 97, + 103, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 106, + 112, + ], + "type": "TSNumberKeyword", + }, + ], + }, + }, + }, + ], + "range": Array [ + 83, + 146, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 3, + }, + }, + "range": Array [ + 113, + 130, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 115, + 130, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 115, + 121, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 3, + }, + "start": Object { + "column": 48, + "line": 3, + }, + }, + "range": Array [ + 124, + 130, + ], + "type": "TSNumberKeyword", + }, + ], + }, + }, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 76, + 146, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 147, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 45, + 53, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 59, + 65, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 68, + 74, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 76, + 82, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 83, + 91, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 97, + 103, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 104, + 105, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 106, + 112, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 3, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 115, + 121, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 46, + "line": 3, + }, + }, + "range": Array [ + 122, + 123, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 3, + }, + "start": Object { + "column": 48, + "line": 3, + }, + }, + "range": Array [ + 124, + 130, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 3, + }, + "start": Object { + "column": 55, + "line": 3, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 135, + 141, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 142, + 143, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 143, + 144, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 145, + 146, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-await.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-await.src.ts.shot new file mode 100644 index 00000000000..9514f6b8a75 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-await.src.ts.shot @@ -0,0 +1,367 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics function-with-await.src 1`] = ` +Object { + "body": Array [ + Object { + "async": true, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "future", + "optional": false, + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 46, + ], + "type": "AwaitExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 47, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 49, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "hope", + "optional": false, + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "future", + "optional": false, + "range": Array [ + 20, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 0, + 49, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "value": "hope", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 26, + ], + "type": "Identifier", + "value": "future", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 39, + ], + "type": "Identifier", + "value": "await", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + "value": "future", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-object-type-with-optional-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-object-type-with-optional-properties.src.ts.shot new file mode 100644 index 00000000000..972236437d2 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-object-type-with-optional-properties.src.ts.shot @@ -0,0 +1,779 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics function-with-object-type-with-optional-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 51, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 14, + 17, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 19, + 22, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 13, + 45, + ], + "type": "ObjectPattern", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 45, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "members": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "optional": true, + "range": Array [ + 26, + 39, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "optional": true, + "range": Array [ + 40, + 44, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 25, + 45, + ], + "type": "TSTypeLiteral", + }, + }, + }, + ], + "range": Array [ + 0, + 51, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-object-type-without-annotation.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-object-type-without-annotation.src.ts.shot new file mode 100644 index 00000000000..15aa7f496ed --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-object-type-without-annotation.src.ts.shot @@ -0,0 +1,743 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics function-with-object-type-without-annotation.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 49, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 14, + 17, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 19, + 22, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 13, + 43, + ], + "type": "ObjectPattern", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 43, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "members": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 26, + 38, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 37, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 39, + 42, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 25, + 43, + ], + "type": "TSTypeLiteral", + }, + }, + }, + ], + "range": Array [ + 0, + 49, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-type-parameters-that-have-comments.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-type-parameters-that-have-comments.src.ts.shot new file mode 100644 index 00000000000..57d31962b11 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-type-parameters-that-have-comments.src.ts.shot @@ -0,0 +1,331 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics function-with-type-parameters-that-have-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 35, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "compare", + "optional": false, + "range": Array [ + 9, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 35, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 28, + 29, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 16, + 30, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 28, + ], + "type": "Block", + "value": "comment", + }, + ], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 16, + ], + "type": "Identifier", + "value": "compare", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-type-parameters-with-constraint.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-type-parameters-with-constraint.src.ts.shot new file mode 100644 index 00000000000..9f8c82cd7ce --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-type-parameters-with-constraint.src.ts.shot @@ -0,0 +1,698 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics function-with-type-parameters-with-constraint.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 40, + 49, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 51, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 25, + 29, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 0, + 51, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 33, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "members": Array [], + "range": Array [ + 21, + 23, + ], + "type": "TSTypeLiteral", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 11, + 23, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 10, + 24, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 20, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-type-parameters.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-type-parameters.src.ts.shot new file mode 100644 index 00000000000..3105d1e9135 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-type-parameters.src.ts.shot @@ -0,0 +1,627 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics function-with-type-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 29, + 38, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 40, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 0, + 40, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 11, + 12, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 10, + 13, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-types-assignation.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-types-assignation.src.ts.shot new file mode 100644 index 00000000000..2c5e6ce2fea --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-types-assignation.src.ts.shot @@ -0,0 +1,946 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics function-with-types-assignation.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "name", + "optional": false, + "range": Array [ + 89, + 93, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 82, + 94, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 78, + "line": 1, + }, + }, + "range": Array [ + 78, + 96, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "message", + "optional": false, + "range": Array [ + 9, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "name", + "optional": false, + "range": Array [ + 17, + 28, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "decorators": Array [], + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "age", + "optional": false, + "range": Array [ + 30, + 40, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 40, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 30, + 46, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 46, + ], + "raw": "100", + "type": "Literal", + "value": 100, + }, + "type": "AssignmentPattern", + "typeAnnotation": undefined, + }, + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "name": "args", + "optional": false, + "range": Array [ + 51, + 55, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 48, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 48, + 69, + ], + "type": "RestElement", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 55, + "line": 1, + }, + }, + "range": Array [ + 55, + 69, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 56, + "line": 1, + }, + }, + "range": Array [ + 56, + 69, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 61, + "line": 1, + }, + "start": Object { + "column": 56, + "line": 1, + }, + }, + "name": "Array", + "optional": false, + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 68, + ], + "type": "TSStringKeyword", + }, + ], + "range": Array [ + 61, + 69, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + "value": undefined, + }, + ], + "range": Array [ + 0, + 96, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 70, + "line": 1, + }, + }, + "range": Array [ + 70, + 77, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 71, + "line": 1, + }, + }, + "range": Array [ + 71, + 77, + ], + "type": "TSStringKeyword", + }, + }, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 97, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 16, + ], + "type": "Identifier", + "value": "message", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 33, + ], + "type": "Identifier", + "value": "age", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 46, + ], + "type": "Numeric", + "value": "100", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 1, + }, + "start": Object { + "column": 48, + "line": 1, + }, + }, + "range": Array [ + 48, + 51, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "range": Array [ + 51, + 55, + ], + "type": "Identifier", + "value": "args", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 55, + "line": 1, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 1, + }, + "start": Object { + "column": 56, + "line": 1, + }, + }, + "range": Array [ + 56, + 61, + ], + "type": "Identifier", + "value": "Array", + }, + Object { + "loc": Object { + "end": Object { + "column": 62, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 68, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 68, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 68, + "line": 1, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 70, + "line": 1, + }, + "start": Object { + "column": 69, + "line": 1, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 1, + }, + "start": Object { + "column": 70, + "line": 1, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 71, + "line": 1, + }, + }, + "range": Array [ + 71, + 77, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 1, + }, + "start": Object { + "column": 78, + "line": 1, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 82, + 88, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 89, + 93, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-types.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-types.src.ts.shot new file mode 100644 index 00000000000..844121df237 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-types.src.ts.shot @@ -0,0 +1,469 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics function-with-types.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "name", + "optional": false, + "range": Array [ + 50, + 54, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 43, + 55, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 57, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "message", + "optional": false, + "range": Array [ + 9, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "name", + "optional": false, + "range": Array [ + 17, + 28, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 57, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 36, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "TSStringKeyword", + }, + }, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 58, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 16, + ], + "type": "Identifier", + "value": "message", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 43, + 49, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 50, + 54, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/global-this.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/global-this.src.ts.shot new file mode 100644 index 00000000000..807c5602ad2 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/global-this.src.ts.shot @@ -0,0 +1,868 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics global-this.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "abc", + "optional": false, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 32, + 35, + ], + "raw": "100", + "type": "Literal", + "value": 100, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 26, + 35, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 22, + 36, + ], + "type": "VariableDeclaration", + }, + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "name": "globalThis", + "optional": false, + "range": Array [ + 69, + 79, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "name": "abc", + "optional": false, + "range": Array [ + 80, + 83, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 69, + 83, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "operator": "=", + "range": Array [ + 69, + 89, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 86, + 89, + ], + "raw": "200", + "type": "Literal", + "value": 200, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 69, + 90, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "name": "answer", + "optional": false, + "range": Array [ + 97, + 103, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 9, + }, + "start": Object { + "column": 13, + "line": 9, + }, + }, + "range": Array [ + 106, + 108, + ], + "raw": "42", + "type": "Literal", + "value": 42, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 97, + 108, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 93, + 109, + ], + "type": "VariableDeclaration", + }, + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 12, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 12, + }, + }, + "name": "globalThis", + "optional": false, + "range": Array [ + 178, + 188, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 12, + }, + "start": Object { + "column": 11, + "line": 12, + }, + }, + "name": "answer", + "optional": false, + "range": Array [ + 189, + 195, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 178, + 195, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 12, + }, + }, + "operator": "=", + "range": Array [ + 178, + 204, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 12, + }, + "start": Object { + "column": 20, + "line": 12, + }, + }, + "range": Array [ + 198, + 204, + ], + "raw": "333333", + "type": "Literal", + "value": 333333, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 12, + }, + }, + "range": Array [ + 178, + 205, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "type": "Line", + "value": " in a global file:", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 38, + 68, + ], + "type": "Line", + "value": " Refers to 'abc' from above.", + }, + Object { + "loc": Object { + "end": Object { + "column": 66, + "line": 11, + }, + "start": Object { + "column": 0, + "line": 11, + }, + }, + "range": Array [ + 111, + 177, + ], + "type": "Line", + "value": " error! Property 'answer' does not exist on 'typeof globalThis'.", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 22, + 206, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "abc", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Numeric", + "value": "100", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 69, + 79, + ], + "type": "Identifier", + "value": "globalThis", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 80, + 83, + ], + "type": "Identifier", + "value": "abc", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 15, + "line": 6, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 86, + 89, + ], + "type": "Numeric", + "value": "200", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 20, + "line": 6, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 93, + 96, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 97, + 103, + ], + "type": "Identifier", + "value": "answer", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 11, + "line": 9, + }, + }, + "range": Array [ + 104, + 105, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 9, + }, + "start": Object { + "column": 13, + "line": 9, + }, + }, + "range": Array [ + 106, + 108, + ], + "type": "Numeric", + "value": "42", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 15, + "line": 9, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 12, + }, + }, + "range": Array [ + 178, + 188, + ], + "type": "Identifier", + "value": "globalThis", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 12, + }, + "start": Object { + "column": 10, + "line": 12, + }, + }, + "range": Array [ + 188, + 189, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 12, + }, + "start": Object { + "column": 11, + "line": 12, + }, + }, + "range": Array [ + 189, + 195, + ], + "type": "Identifier", + "value": "answer", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 12, + }, + "start": Object { + "column": 18, + "line": 12, + }, + }, + "range": Array [ + 196, + 197, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 12, + }, + "start": Object { + "column": 20, + "line": 12, + }, + }, + "range": Array [ + 198, + 204, + ], + "type": "Numeric", + "value": "333333", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 12, + }, + "start": Object { + "column": 26, + "line": 12, + }, + }, + "range": Array [ + 204, + 205, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-equal-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-equal-declaration.src.ts.shot new file mode 100644 index 00000000000..9a2a76e6233 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-equal-declaration.src.ts.shot @@ -0,0 +1,247 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics import-equal-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "importKind": "value", + "isExport": false, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "moduleReference": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 26, + ], + "raw": "'bar'", + "type": "Literal", + "value": "bar", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 27, + ], + "type": "TSExternalModuleReference", + }, + "range": Array [ + 0, + 28, + ], + "type": "TSImportEqualsDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 20, + ], + "type": "Identifier", + "value": "require", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 26, + ], + "type": "String", + "value": "'bar'", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-equal-type-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-equal-type-declaration.src.ts.shot new file mode 100644 index 00000000000..5528903ee6b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-equal-type-declaration.src.ts.shot @@ -0,0 +1,265 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics import-equal-type-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "importKind": "type", + "isExport": false, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "moduleReference": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 31, + ], + "raw": "'bar'", + "type": "Literal", + "value": "bar", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 32, + ], + "type": "TSExternalModuleReference", + }, + "range": Array [ + 0, + 33, + ], + "type": "TSImportEqualsDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 25, + ], + "type": "Identifier", + "value": "require", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 31, + ], + "type": "String", + "value": "'bar'", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-export-equal-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-export-equal-declaration.src.ts.shot new file mode 100644 index 00000000000..d8e642b0590 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-export-equal-declaration.src.ts.shot @@ -0,0 +1,265 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics import-export-equal-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "importKind": "value", + "isExport": true, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "moduleReference": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 33, + ], + "raw": "'bar'", + "type": "Literal", + "value": "bar", + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 34, + ], + "type": "TSExternalModuleReference", + }, + "range": Array [ + 0, + 35, + ], + "type": "TSImportEqualsDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 27, + ], + "type": "Identifier", + "value": "require", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 33, + ], + "type": "String", + "value": "'bar'", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-export-equal-type-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-export-equal-type-declaration.src.ts.shot new file mode 100644 index 00000000000..e209bf0617d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-export-equal-type-declaration.src.ts.shot @@ -0,0 +1,283 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics import-export-equal-type-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "importKind": "type", + "isExport": true, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "moduleReference": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 38, + ], + "raw": "'bar'", + "type": "Literal", + "value": "bar", + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 39, + ], + "type": "TSExternalModuleReference", + }, + "range": Array [ + 0, + 40, + ], + "type": "TSImportEqualsDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 32, + ], + "type": "Identifier", + "value": "require", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 38, + ], + "type": "String", + "value": "'bar'", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-default.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-default.src.ts.shot new file mode 100644 index 00000000000..37f4d356ac2 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-default.src.ts.shot @@ -0,0 +1,213 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics import-type-default.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "type", + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 26, + ], + "raw": "'bar'", + "type": "Literal", + "value": "bar", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 12, + 15, + ], + "type": "ImportDefaultSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 20, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 26, + ], + "type": "String", + "value": "'bar'", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-empty.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-empty.src.ts.shot new file mode 100644 index 00000000000..bf0a2bf3d21 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-empty.src.ts.shot @@ -0,0 +1,214 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics import-type-empty.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "value", + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 55, + 80, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 72, + 79, + ], + "raw": "'./foo'", + "type": "Literal", + "value": "./foo", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "name": "type", + "optional": false, + "range": Array [ + 62, + 66, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 62, + 66, + ], + "type": "ImportDefaultSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 54, + ], + "type": "Line", + "value": " this should be treated as a normal import statement", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 55, + 81, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 55, + 61, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 62, + 66, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 67, + 71, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 72, + 79, + ], + "type": "String", + "value": "'./foo'", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-error.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-error.src.ts.shot new file mode 100644 index 00000000000..e5b0845f2ad --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-error.src.ts.shot @@ -0,0 +1,345 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics import-type-error.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "type", + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 35, + ], + "raw": "'bar'", + "type": "Literal", + "value": "bar", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 12, + 15, + ], + "type": "ImportDefaultSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 19, + 22, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 29, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 35, + ], + "type": "String", + "value": "'bar'", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-named-as.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-named-as.src.ts.shot new file mode 100644 index 00000000000..9ad033cfb1c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-named-as.src.ts.shot @@ -0,0 +1,307 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics import-type-named-as.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "type", + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 37, + ], + "raw": "'baz'", + "type": "Literal", + "value": "baz", + }, + "specifiers": Array [ + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 14, + 24, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 31, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 37, + ], + "type": "String", + "value": "'baz'", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-named.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-named.src.ts.shot new file mode 100644 index 00000000000..07ec1f7ce92 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-named.src.ts.shot @@ -0,0 +1,367 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics import-type-named.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "type", + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 35, + ], + "raw": "'baz'", + "type": "Literal", + "value": "baz", + }, + "specifiers": Array [ + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 14, + 17, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 19, + 22, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 29, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 35, + ], + "type": "String", + "value": "'baz'", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-star-as-ns.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-star-as-ns.src.ts.shot new file mode 100644 index 00000000000..49e8bfdb5e4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-type-star-as-ns.src.ts.shot @@ -0,0 +1,249 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics import-type-star-as-ns.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "type", + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 33, + ], + "raw": "'./bar'", + "type": "Literal", + "value": "./bar", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 12, + 20, + ], + "type": "ImportNamespaceSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 25, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 33, + ], + "type": "String", + "value": "'./bar'", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/import-with-import-assertions.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/import-with-import-assertions.src.ts.shot new file mode 100644 index 00000000000..7da9b8788b7 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/import-with-import-assertions.src.ts.shot @@ -0,0 +1,361 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics import-with-import-assertions.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [ + Object { + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "name": "type", + "optional": false, + "range": Array [ + 31, + 35, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 43, + ], + "type": "ImportAttribute", + "value": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 43, + ], + "raw": "\\"json\\"", + "type": "Literal", + "value": "json", + }, + }, + ], + "importKind": "value", + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 46, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "raw": "\\"mod\\"", + "type": "Literal", + "value": "mod", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 7, + 10, + ], + "type": "ImportDefaultSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 21, + ], + "type": "String", + "value": "\\"mod\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + "value": "assert", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 35, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 43, + ], + "type": "String", + "value": "\\"json\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-extends-multiple.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-extends-multiple.src.ts.shot new file mode 100644 index 00000000000..b501a9707cd --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-extends-multiple.src.ts.shot @@ -0,0 +1,309 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics interface-extends-multiple.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 34, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "Bar", + "optional": false, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "TSInterfaceHeritage", + "typeParameters": undefined, + }, + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "Baz", + "optional": false, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "TSInterfaceHeritage", + "typeParameters": undefined, + }, + ], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "Baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-extends.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-extends.src.ts.shot new file mode 100644 index 00000000000..8524d88e020 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-extends.src.ts.shot @@ -0,0 +1,234 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics interface-extends.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 30, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "Bar", + "optional": false, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "TSInterfaceHeritage", + "typeParameters": undefined, + }, + ], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-type-parameters.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-type-parameters.src.ts.shot new file mode 100644 index 00000000000..b508cbae137 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-type-parameters.src.ts.shot @@ -0,0 +1,272 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics interface-type-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 14, + 15, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 13, + 16, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-all-property-types.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-all-property-types.src.ts.shot new file mode 100644 index 00000000000..8bc85fa7687 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-all-property-types.src.ts.shot @@ -0,0 +1,3196 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics interface-with-all-property-types.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "baa", + "optional": false, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 20, + 32, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 23, + 31, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "TSNumberKeyword", + }, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 37, + 40, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "optional": true, + "range": Array [ + 37, + 50, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 41, + 49, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 43, + 49, + ], + "type": "TSNumberKeyword", + }, + }, + }, + Object { + "accessibility": undefined, + "computed": true, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "name": "bax", + "optional": false, + "range": Array [ + 56, + 59, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 55, + 69, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 60, + 68, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 62, + 68, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": undefined, + "computed": true, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 75, + 78, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "optional": true, + "range": Array [ + 74, + 89, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 80, + 88, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 82, + 88, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": undefined, + "export": false, + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "parameters": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "name": "eee", + "optional": false, + "range": Array [ + 95, + 106, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 98, + 106, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 100, + 106, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 94, + 116, + ], + "readonly": false, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 107, + 115, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "range": Array [ + 109, + 115, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "name": "doo", + "optional": false, + "range": Array [ + 121, + 124, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "optional": false, + "params": Array [], + "range": Array [ + 121, + 133, + ], + "readonly": false, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "range": Array [ + 126, + 132, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 128, + 132, + ], + "type": "TSVoidKeyword", + }, + }, + "static": false, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "name": "coo", + "optional": false, + "range": Array [ + 138, + 141, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 24, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "optional": true, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 143, + 144, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 8, + }, + "start": Object { + "column": 12, + "line": 8, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 146, + 147, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 149, + 150, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 138, + 158, + ], + "readonly": false, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 8, + }, + "start": Object { + "column": 17, + "line": 8, + }, + }, + "range": Array [ + 151, + 157, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 8, + }, + "start": Object { + "column": 19, + "line": 8, + }, + }, + "range": Array [ + 153, + 157, + ], + "type": "TSVoidKeyword", + }, + }, + "static": false, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + Object { + "accessibility": undefined, + "computed": true, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 9, + }, + "start": Object { + "column": 5, + "line": 9, + }, + }, + "name": "loo", + "optional": false, + "range": Array [ + 164, + 167, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 26, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "optional": true, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 11, + "line": 9, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 170, + 171, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 9, + }, + "start": Object { + "column": 14, + "line": 9, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 173, + 174, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 17, + "line": 9, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 176, + 177, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 163, + 185, + ], + "readonly": false, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 9, + }, + "start": Object { + "column": 19, + "line": 9, + }, + }, + "range": Array [ + 178, + 184, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 9, + }, + "start": Object { + "column": 21, + "line": 9, + }, + }, + "range": Array [ + 180, + 184, + ], + "type": "TSVoidKeyword", + }, + }, + "static": false, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 10, + }, + }, + "name": "boo", + "optional": false, + "range": Array [ + 190, + 193, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 26, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 10, + }, + }, + "optional": false, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 10, + }, + "start": Object { + "column": 11, + "line": 10, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 197, + 198, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 14, + "line": 10, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 200, + 201, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 10, + }, + "start": Object { + "column": 17, + "line": 10, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 203, + 204, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 190, + 212, + ], + "readonly": false, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 10, + }, + "start": Object { + "column": 19, + "line": 10, + }, + }, + "range": Array [ + 205, + 211, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 10, + }, + "start": Object { + "column": 21, + "line": 10, + }, + }, + "range": Array [ + 207, + 211, + ], + "type": "TSVoidKeyword", + }, + }, + "static": false, + "type": "TSMethodSignature", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 10, + }, + "start": Object { + "column": 7, + "line": 10, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "name": "J", + "optional": false, + "range": Array [ + 194, + 195, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 194, + 195, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 193, + 196, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 11, + }, + "start": Object { + "column": 9, + "line": 11, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 222, + 223, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 11, + }, + "start": Object { + "column": 12, + "line": 11, + }, + }, + "name": "b", + "optional": true, + "range": Array [ + 225, + 227, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 217, + 237, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 11, + }, + "start": Object { + "column": 15, + "line": 11, + }, + }, + "range": Array [ + 228, + 236, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 11, + }, + "start": Object { + "column": 17, + "line": 11, + }, + }, + "range": Array [ + 230, + 236, + ], + "type": "TSStringKeyword", + }, + }, + "type": "TSConstructSignatureDeclaration", + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 12, + }, + "start": Object { + "column": 4, + "line": 12, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 12, + }, + "start": Object { + "column": 12, + "line": 12, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 250, + 251, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 12, + }, + "start": Object { + "column": 15, + "line": 12, + }, + }, + "name": "b", + "optional": true, + "range": Array [ + 253, + 255, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 242, + 265, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 12, + }, + "start": Object { + "column": 18, + "line": 12, + }, + }, + "range": Array [ + 256, + 264, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 12, + }, + "start": Object { + "column": 20, + "line": 12, + }, + }, + "range": Array [ + 258, + 264, + ], + "type": "TSStringKeyword", + }, + }, + "type": "TSConstructSignatureDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 12, + }, + "start": Object { + "column": 8, + "line": 12, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 12, + }, + "start": Object { + "column": 9, + "line": 12, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 12, + }, + "start": Object { + "column": 9, + "line": 12, + }, + }, + "name": "F", + "optional": false, + "range": Array [ + 247, + 248, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 247, + 248, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 246, + 249, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 267, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 267, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 15, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 269, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + "value": "baa", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 37, + 40, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 43, + 49, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 56, + 59, + ], + "type": "Identifier", + "value": "bax", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 62, + 68, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 75, + 78, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 82, + 88, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "range": Array [ + 95, + 98, + ], + "type": "Identifier", + "value": "eee", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 100, + 106, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "range": Array [ + 109, + 115, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 25, + "line": 6, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 121, + 124, + ], + "type": "Identifier", + "value": "doo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 125, + 126, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "range": Array [ + 126, + 127, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 128, + 132, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 7, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 4, + "line": 8, + }, + }, + "range": Array [ + 138, + 141, + ], + "type": "Identifier", + "value": "coo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 141, + 142, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 142, + 143, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "range": Array [ + 143, + 144, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 8, + }, + }, + "range": Array [ + 144, + 145, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 8, + }, + "start": Object { + "column": 12, + "line": 8, + }, + }, + "range": Array [ + 146, + 147, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 13, + "line": 8, + }, + }, + "range": Array [ + 147, + 148, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 149, + 150, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 8, + }, + "start": Object { + "column": 16, + "line": 8, + }, + }, + "range": Array [ + 150, + 151, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 8, + }, + "start": Object { + "column": 17, + "line": 8, + }, + }, + "range": Array [ + 151, + 152, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 8, + }, + "start": Object { + "column": 19, + "line": 8, + }, + }, + "range": Array [ + 153, + 157, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 8, + }, + "start": Object { + "column": 23, + "line": 8, + }, + }, + "range": Array [ + 157, + 158, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 163, + 164, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 9, + }, + "start": Object { + "column": 5, + "line": 9, + }, + }, + "range": Array [ + 164, + 167, + ], + "type": "Identifier", + "value": "loo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "range": Array [ + 167, + 168, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 9, + "line": 9, + }, + }, + "range": Array [ + 168, + 169, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "start": Object { + "column": 10, + "line": 9, + }, + }, + "range": Array [ + 169, + 170, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 11, + "line": 9, + }, + }, + "range": Array [ + 170, + 171, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "range": Array [ + 171, + 172, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 9, + }, + "start": Object { + "column": 14, + "line": 9, + }, + }, + "range": Array [ + 173, + 174, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 15, + "line": 9, + }, + }, + "range": Array [ + 174, + 175, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 17, + "line": 9, + }, + }, + "range": Array [ + 176, + 177, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 18, + "line": 9, + }, + }, + "range": Array [ + 177, + 178, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 9, + }, + "start": Object { + "column": 19, + "line": 9, + }, + }, + "range": Array [ + 178, + 179, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 9, + }, + "start": Object { + "column": 21, + "line": 9, + }, + }, + "range": Array [ + 180, + 184, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 9, + }, + "start": Object { + "column": 25, + "line": 9, + }, + }, + "range": Array [ + 184, + 185, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 10, + }, + "start": Object { + "column": 4, + "line": 10, + }, + }, + "range": Array [ + 190, + 193, + ], + "type": "Identifier", + "value": "boo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 10, + }, + "start": Object { + "column": 7, + "line": 10, + }, + }, + "range": Array [ + 193, + 194, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "range": Array [ + 194, + 195, + ], + "type": "Identifier", + "value": "J", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 10, + }, + "start": Object { + "column": 9, + "line": 10, + }, + }, + "range": Array [ + 195, + 196, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 10, + }, + "start": Object { + "column": 10, + "line": 10, + }, + }, + "range": Array [ + 196, + 197, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 10, + }, + "start": Object { + "column": 11, + "line": 10, + }, + }, + "range": Array [ + 197, + 198, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 10, + }, + "start": Object { + "column": 12, + "line": 10, + }, + }, + "range": Array [ + 198, + 199, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 14, + "line": 10, + }, + }, + "range": Array [ + 200, + 201, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 10, + }, + "start": Object { + "column": 15, + "line": 10, + }, + }, + "range": Array [ + 201, + 202, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 10, + }, + "start": Object { + "column": 17, + "line": 10, + }, + }, + "range": Array [ + 203, + 204, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 10, + }, + "start": Object { + "column": 18, + "line": 10, + }, + }, + "range": Array [ + 204, + 205, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 10, + }, + "start": Object { + "column": 19, + "line": 10, + }, + }, + "range": Array [ + 205, + 206, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 10, + }, + "start": Object { + "column": 21, + "line": 10, + }, + }, + "range": Array [ + 207, + 211, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 10, + }, + "start": Object { + "column": 25, + "line": 10, + }, + }, + "range": Array [ + 211, + 212, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "range": Array [ + 217, + 220, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 11, + }, + "start": Object { + "column": 8, + "line": 11, + }, + }, + "range": Array [ + 221, + 222, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 11, + }, + "start": Object { + "column": 9, + "line": 11, + }, + }, + "range": Array [ + 222, + 223, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 11, + }, + "start": Object { + "column": 10, + "line": 11, + }, + }, + "range": Array [ + 223, + 224, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 11, + }, + "start": Object { + "column": 12, + "line": 11, + }, + }, + "range": Array [ + 225, + 226, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 11, + }, + "start": Object { + "column": 13, + "line": 11, + }, + }, + "range": Array [ + 226, + 227, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 11, + }, + "start": Object { + "column": 14, + "line": 11, + }, + }, + "range": Array [ + 227, + 228, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 11, + }, + "start": Object { + "column": 15, + "line": 11, + }, + }, + "range": Array [ + 228, + 229, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 11, + }, + "start": Object { + "column": 17, + "line": 11, + }, + }, + "range": Array [ + 230, + 236, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 11, + }, + "start": Object { + "column": 23, + "line": 11, + }, + }, + "range": Array [ + 236, + 237, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 12, + }, + "start": Object { + "column": 4, + "line": 12, + }, + }, + "range": Array [ + 242, + 245, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 12, + }, + "start": Object { + "column": 8, + "line": 12, + }, + }, + "range": Array [ + 246, + 247, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 12, + }, + "start": Object { + "column": 9, + "line": 12, + }, + }, + "range": Array [ + 247, + 248, + ], + "type": "Identifier", + "value": "F", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 12, + }, + "start": Object { + "column": 10, + "line": 12, + }, + }, + "range": Array [ + 248, + 249, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 12, + }, + "start": Object { + "column": 11, + "line": 12, + }, + }, + "range": Array [ + 249, + 250, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 12, + }, + "start": Object { + "column": 12, + "line": 12, + }, + }, + "range": Array [ + 250, + 251, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 12, + }, + "start": Object { + "column": 13, + "line": 12, + }, + }, + "range": Array [ + 251, + 252, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 12, + }, + "start": Object { + "column": 15, + "line": 12, + }, + }, + "range": Array [ + 253, + 254, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 12, + }, + "start": Object { + "column": 16, + "line": 12, + }, + }, + "range": Array [ + 254, + 255, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 12, + }, + "start": Object { + "column": 17, + "line": 12, + }, + }, + "range": Array [ + 255, + 256, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 12, + }, + "start": Object { + "column": 18, + "line": 12, + }, + }, + "range": Array [ + 256, + 257, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 12, + }, + "start": Object { + "column": 20, + "line": 12, + }, + }, + "range": Array [ + 258, + 264, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 12, + }, + "start": Object { + "column": 26, + "line": 12, + }, + }, + "range": Array [ + 264, + 265, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 13, + }, + }, + "range": Array [ + 266, + 267, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src.ts.shot new file mode 100644 index 00000000000..c6e9757b2fa --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-construct-signature-with-parameter-accessibility.src.ts.shot @@ -0,0 +1,430 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics interface-with-construct-signature-with-parameter-accessibility.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "params": Array [ + Object { + "accessibility": "public", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "override": false, + "parameter": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 26, + 34, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "private", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "override": false, + "parameter": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 36, + 45, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 21, + 47, + ], + "returnType": undefined, + "type": "TSConstructSignatureDeclaration", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 49, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Test", + "optional": false, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "Test", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 36, + 43, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-extends-member-expression.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-extends-member-expression.src.ts.shot new file mode 100644 index 00000000000..1ee22831720 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-extends-member-expression.src.ts.shot @@ -0,0 +1,310 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics interface-with-extends-member-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 33, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [ + Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 22, + 29, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 29, + ], + "type": "TSInterfaceHeritage", + "typeParameters": undefined, + }, + ], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-extends-type-parameters.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-extends-type-parameters.src.ts.shot new file mode 100644 index 00000000000..e0e55ee3945 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-extends-type-parameters.src.ts.shot @@ -0,0 +1,459 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics interface-with-extends-type-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 36, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "Bar", + "optional": false, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "TSInterfaceHeritage", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "J", + "optional": false, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 28, + 31, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + ], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 14, + 15, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 13, + 16, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 24, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "value": "J", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-generic.src.ts.shot new file mode 100644 index 00000000000..bb5079d781d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-generic.src.ts.shot @@ -0,0 +1,272 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics interface-with-generic.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Test", + "optional": false, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 15, + 16, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 14, + 17, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "Test", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-jsdoc.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-jsdoc.src.ts.shot new file mode 100644 index 00000000000..7a4cb6b571d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-jsdoc.src.ts.shot @@ -0,0 +1,341 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics interface-with-jsdoc.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 76, + 79, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "optional": false, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 80, + 83, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 76, + 85, + ], + "readonly": false, + "returnType": undefined, + "static": false, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 87, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Test", + "optional": false, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 87, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 71, + ], + "type": "Block", + "value": "* + * Comment Line 1 + * @baz bar + ", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 88, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "Test", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 76, + 79, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 80, + 83, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-method.src.ts.shot new file mode 100644 index 00000000000..e82eb8b7cb6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-method.src.ts.shot @@ -0,0 +1,913 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics interface-with-method.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "h", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 21, + 32, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 24, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 19, + 40, + ], + "readonly": false, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 33, + 39, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 35, + 39, + ], + "type": "TSVoidKeyword", + }, + }, + "static": false, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "g", + "optional": false, + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 48, + 54, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 51, + 54, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 43, + 59, + ], + "readonly": false, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 55, + 58, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 57, + 58, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "static": false, + "type": "TSMethodSignature", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 45, + 46, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 44, + 47, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 61, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "test", + "optional": false, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 61, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 62, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "h", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 35, + 39, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + "value": "g", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 48, + 51, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-optional-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-optional-properties.src.ts.shot new file mode 100644 index 00000000000..1a1c822d9b4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-optional-properties.src.ts.shot @@ -0,0 +1,825 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics interface-with-optional-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": true, + "range": Array [ + 21, + 26, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": undefined, + }, + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "optional": true, + "range": Array [ + 31, + 44, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 35, + 43, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 37, + 43, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 49, + 52, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 34, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "optional": true, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 54, + 57, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "name": "bar", + "optional": true, + "range": Array [ + 59, + 71, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 63, + 71, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 20, + "line": 4, + }, + }, + "range": Array [ + 65, + 71, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "name": "baz", + "optional": true, + "range": Array [ + 73, + 77, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 49, + 79, + ], + "readonly": false, + "returnType": undefined, + "static": false, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 81, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "test", + "optional": false, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 81, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 82, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 37, + 43, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 49, + 52, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 54, + 57, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 59, + 62, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 20, + "line": 4, + }, + }, + "range": Array [ + 65, + 71, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 73, + 76, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 31, + "line": 4, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 4, + }, + "start": Object { + "column": 32, + "line": 4, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 4, + }, + "start": Object { + "column": 33, + "line": 4, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-without-type-annotation.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-without-type-annotation.src.ts.shot new file mode 100644 index 00000000000..81c669ee9db --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-without-type-annotation.src.ts.shot @@ -0,0 +1,241 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics interface-without-type-annotation.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 21, + 25, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 27, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "test", + "optional": false, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 14, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/intrinsic-keyword.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/intrinsic-keyword.src.ts.shot new file mode 100644 index 00000000000..039aea820b3 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/intrinsic-keyword.src.ts.shot @@ -0,0 +1,1279 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics intrinsic-keyword.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Uppercase", + "optional": false, + "range": Array [ + 5, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 44, + ], + "type": "TSIntrinsicKeyword", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "TSStringKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "S", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 15, + 31, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 14, + 32, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "Lowercase", + "optional": false, + "range": Array [ + 51, + 60, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 46, + 91, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 81, + 90, + ], + "type": "TSIntrinsicKeyword", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 71, + 77, + ], + "type": "TSStringKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "name": "S", + "optional": false, + "range": Array [ + 61, + 62, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 61, + 77, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 60, + 78, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "Capitalize", + "optional": false, + "range": Array [ + 97, + 107, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 92, + 138, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 128, + 137, + ], + "type": "TSIntrinsicKeyword", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 118, + 124, + ], + "type": "TSStringKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "name": "S", + "optional": false, + "range": Array [ + 108, + 109, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 108, + 124, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 107, + 125, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "name": "Uncapitalize", + "optional": false, + "range": Array [ + 144, + 156, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 48, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 139, + 187, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 4, + }, + "start": Object { + "column": 38, + "line": 4, + }, + }, + "range": Array [ + 177, + 186, + ], + "type": "TSIntrinsicKeyword", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 167, + 173, + ], + "type": "TSStringKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 34, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "name": "S", + "optional": false, + "range": Array [ + 157, + 158, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 157, + 173, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 156, + 174, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 188, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 14, + ], + "type": "Identifier", + "value": "Uppercase", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "S", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 24, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 44, + ], + "type": "Identifier", + "value": "intrinsic", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 46, + 50, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 51, + 60, + ], + "type": "Identifier", + "value": "Lowercase", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Identifier", + "value": "S", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 63, + 70, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 71, + 77, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 81, + 90, + ], + "type": "Identifier", + "value": "intrinsic", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 92, + 96, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 97, + 107, + ], + "type": "Identifier", + "value": "Capitalize", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Identifier", + "value": "S", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 110, + 117, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 118, + 124, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 32, + "line": 3, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 3, + }, + "start": Object { + "column": 34, + "line": 3, + }, + }, + "range": Array [ + 126, + 127, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 128, + 137, + ], + "type": "Identifier", + "value": "intrinsic", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 45, + "line": 3, + }, + }, + "range": Array [ + 137, + 138, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 139, + 143, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 144, + 156, + ], + "type": "Identifier", + "value": "Uncapitalize", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 156, + 157, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 157, + 158, + ], + "type": "Identifier", + "value": "S", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 20, + "line": 4, + }, + }, + "range": Array [ + 159, + 166, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 167, + 173, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 4, + }, + "start": Object { + "column": 34, + "line": 4, + }, + }, + "range": Array [ + 173, + 174, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 4, + }, + "start": Object { + "column": 36, + "line": 4, + }, + }, + "range": Array [ + 175, + 176, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 4, + }, + "start": Object { + "column": 38, + "line": 4, + }, + }, + "range": Array [ + 177, + 186, + ], + "type": "Identifier", + "value": "intrinsic", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 4, + }, + "start": Object { + "column": 47, + "line": 4, + }, + }, + "range": Array [ + 186, + 187, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/keyof-operator.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/keyof-operator.src.ts.shot new file mode 100644 index 00000000000..6f229cb965a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/keyof-operator.src.ts.shot @@ -0,0 +1,232 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics keyof-operator.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "operator": "keyof", + "range": Array [ + 9, + 18, + ], + "type": "TSTypeOperator", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Identifier", + "value": "keyof", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/keyword-variables.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/keyword-variables.src.ts.shot new file mode 100644 index 00000000000..fddca0c561d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/keyword-variables.src.ts.shot @@ -0,0 +1,9764 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics keyword-variables.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": "abstract", + "optional": false, + "range": Array [ + 10, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 10, + 22, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 4, + 23, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "as", + "optional": false, + "range": Array [ + 32, + 34, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 37, + 38, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 26, + 39, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "name": "asserts", + "optional": false, + "range": Array [ + 48, + 55, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 58, + 59, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 48, + 59, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 42, + 60, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": "any", + "optional": false, + "range": Array [ + 69, + 72, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 75, + 76, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 69, + 76, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 63, + 77, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "name": "async", + "optional": false, + "range": Array [ + 86, + 91, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 94, + 95, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 86, + 95, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 80, + 96, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "name": "await", + "optional": false, + "range": Array [ + 105, + 110, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 7, + }, + }, + "range": Array [ + 113, + 114, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 105, + 114, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 99, + 115, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "name": "boolean", + "optional": false, + "range": Array [ + 124, + 131, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 8, + }, + "start": Object { + "column": 18, + "line": 8, + }, + }, + "range": Array [ + 134, + 135, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 124, + 135, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 20, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 118, + 136, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 145, + 156, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 9, + }, + "start": Object { + "column": 22, + "line": 9, + }, + }, + "range": Array [ + 159, + 160, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "range": Array [ + 145, + 160, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 24, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 139, + 161, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "name": "declare", + "optional": false, + "range": Array [ + 170, + 177, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 10, + }, + "start": Object { + "column": 18, + "line": 10, + }, + }, + "range": Array [ + 180, + 181, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "range": Array [ + 170, + 181, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 20, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 164, + 182, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 11, + }, + "start": Object { + "column": 8, + "line": 11, + }, + }, + "name": "get", + "optional": false, + "range": Array [ + 191, + 194, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 11, + }, + "start": Object { + "column": 14, + "line": 11, + }, + }, + "range": Array [ + 197, + 198, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 11, + }, + "start": Object { + "column": 8, + "line": 11, + }, + }, + "range": Array [ + 191, + 198, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 16, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "range": Array [ + 185, + 199, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 12, + }, + "start": Object { + "column": 8, + "line": 12, + }, + }, + "name": "infer", + "optional": false, + "range": Array [ + 208, + 213, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 12, + }, + "start": Object { + "column": 16, + "line": 12, + }, + }, + "range": Array [ + 216, + 217, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 12, + }, + "start": Object { + "column": 8, + "line": 12, + }, + }, + "range": Array [ + 208, + 217, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 18, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "range": Array [ + 202, + 218, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 13, + }, + "start": Object { + "column": 8, + "line": 13, + }, + }, + "name": "is", + "optional": false, + "range": Array [ + 227, + 229, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 13, + }, + "start": Object { + "column": 13, + "line": 13, + }, + }, + "range": Array [ + 232, + 233, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 13, + }, + "start": Object { + "column": 8, + "line": 13, + }, + }, + "range": Array [ + 227, + 233, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 15, + "line": 13, + }, + "start": Object { + "column": 2, + "line": 13, + }, + }, + "range": Array [ + 221, + 234, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 14, + }, + "start": Object { + "column": 8, + "line": 14, + }, + }, + "name": "keyof", + "optional": false, + "range": Array [ + 243, + 248, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 14, + }, + "start": Object { + "column": 16, + "line": 14, + }, + }, + "range": Array [ + 251, + 252, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 14, + }, + "start": Object { + "column": 8, + "line": 14, + }, + }, + "range": Array [ + 243, + 252, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 18, + "line": 14, + }, + "start": Object { + "column": 2, + "line": 14, + }, + }, + "range": Array [ + 237, + 253, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 15, + }, + "start": Object { + "column": 8, + "line": 15, + }, + }, + "name": "module", + "optional": false, + "range": Array [ + 262, + 268, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 15, + }, + "start": Object { + "column": 17, + "line": 15, + }, + }, + "range": Array [ + 271, + 272, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 15, + }, + "start": Object { + "column": 8, + "line": 15, + }, + }, + "range": Array [ + 262, + 272, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 19, + "line": 15, + }, + "start": Object { + "column": 2, + "line": 15, + }, + }, + "range": Array [ + 256, + 273, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 16, + }, + "start": Object { + "column": 8, + "line": 16, + }, + }, + "name": "namespace", + "optional": false, + "range": Array [ + 282, + 291, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 16, + }, + "start": Object { + "column": 20, + "line": 16, + }, + }, + "range": Array [ + 294, + 295, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 16, + }, + "start": Object { + "column": 8, + "line": 16, + }, + }, + "range": Array [ + 282, + 295, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 22, + "line": 16, + }, + "start": Object { + "column": 2, + "line": 16, + }, + }, + "range": Array [ + 276, + 296, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 17, + }, + "start": Object { + "column": 8, + "line": 17, + }, + }, + "name": "never", + "optional": false, + "range": Array [ + 305, + 310, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 17, + }, + "start": Object { + "column": 16, + "line": 17, + }, + }, + "range": Array [ + 313, + 314, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 17, + }, + "start": Object { + "column": 8, + "line": 17, + }, + }, + "range": Array [ + 305, + 314, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 18, + "line": 17, + }, + "start": Object { + "column": 2, + "line": 17, + }, + }, + "range": Array [ + 299, + 315, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 18, + }, + "start": Object { + "column": 8, + "line": 18, + }, + }, + "name": "readonly", + "optional": false, + "range": Array [ + 324, + 332, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 18, + }, + "start": Object { + "column": 19, + "line": 18, + }, + }, + "range": Array [ + 335, + 336, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 18, + }, + "start": Object { + "column": 8, + "line": 18, + }, + }, + "range": Array [ + 324, + 336, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 21, + "line": 18, + }, + "start": Object { + "column": 2, + "line": 18, + }, + }, + "range": Array [ + 318, + 337, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 19, + }, + "start": Object { + "column": 8, + "line": 19, + }, + }, + "name": "require", + "optional": false, + "range": Array [ + 346, + 353, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 19, + }, + "start": Object { + "column": 18, + "line": 19, + }, + }, + "range": Array [ + 356, + 357, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 19, + }, + "start": Object { + "column": 8, + "line": 19, + }, + }, + "range": Array [ + 346, + 357, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 20, + "line": 19, + }, + "start": Object { + "column": 2, + "line": 19, + }, + }, + "range": Array [ + 340, + 358, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 20, + }, + "start": Object { + "column": 8, + "line": 20, + }, + }, + "name": "number", + "optional": false, + "range": Array [ + 367, + 373, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 20, + }, + "start": Object { + "column": 17, + "line": 20, + }, + }, + "range": Array [ + 376, + 377, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 20, + }, + "start": Object { + "column": 8, + "line": 20, + }, + }, + "range": Array [ + 367, + 377, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 19, + "line": 20, + }, + "start": Object { + "column": 2, + "line": 20, + }, + }, + "range": Array [ + 361, + 378, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 21, + }, + "start": Object { + "column": 8, + "line": 21, + }, + }, + "name": "object", + "optional": false, + "range": Array [ + 387, + 393, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 21, + }, + "start": Object { + "column": 17, + "line": 21, + }, + }, + "range": Array [ + 396, + 397, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 21, + }, + "start": Object { + "column": 8, + "line": 21, + }, + }, + "range": Array [ + 387, + 397, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 19, + "line": 21, + }, + "start": Object { + "column": 2, + "line": 21, + }, + }, + "range": Array [ + 381, + 398, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 22, + }, + "start": Object { + "column": 8, + "line": 22, + }, + }, + "name": "set", + "optional": false, + "range": Array [ + 407, + 410, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 22, + }, + "start": Object { + "column": 14, + "line": 22, + }, + }, + "range": Array [ + 413, + 414, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 22, + }, + "start": Object { + "column": 8, + "line": 22, + }, + }, + "range": Array [ + 407, + 414, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 16, + "line": 22, + }, + "start": Object { + "column": 2, + "line": 22, + }, + }, + "range": Array [ + 401, + 415, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 23, + }, + "start": Object { + "column": 8, + "line": 23, + }, + }, + "name": "string", + "optional": false, + "range": Array [ + 424, + 430, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 23, + }, + "start": Object { + "column": 17, + "line": 23, + }, + }, + "range": Array [ + 433, + 434, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 23, + }, + "start": Object { + "column": 8, + "line": 23, + }, + }, + "range": Array [ + 424, + 434, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 19, + "line": 23, + }, + "start": Object { + "column": 2, + "line": 23, + }, + }, + "range": Array [ + 418, + 435, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 24, + }, + "start": Object { + "column": 8, + "line": 24, + }, + }, + "name": "symbol", + "optional": false, + "range": Array [ + 444, + 450, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 24, + }, + "start": Object { + "column": 17, + "line": 24, + }, + }, + "range": Array [ + 453, + 454, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 24, + }, + "start": Object { + "column": 8, + "line": 24, + }, + }, + "range": Array [ + 444, + 454, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 19, + "line": 24, + }, + "start": Object { + "column": 2, + "line": 24, + }, + }, + "range": Array [ + 438, + 455, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 25, + }, + "start": Object { + "column": 8, + "line": 25, + }, + }, + "name": "type", + "optional": false, + "range": Array [ + 464, + 468, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 25, + }, + "start": Object { + "column": 15, + "line": 25, + }, + }, + "range": Array [ + 471, + 472, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 25, + }, + "start": Object { + "column": 8, + "line": 25, + }, + }, + "range": Array [ + 464, + 472, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 17, + "line": 25, + }, + "start": Object { + "column": 2, + "line": 25, + }, + }, + "range": Array [ + 458, + 473, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 26, + }, + "start": Object { + "column": 8, + "line": 26, + }, + }, + "name": "undefined", + "optional": false, + "range": Array [ + 482, + 491, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 26, + }, + "start": Object { + "column": 20, + "line": 26, + }, + }, + "range": Array [ + 494, + 495, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 26, + }, + "start": Object { + "column": 8, + "line": 26, + }, + }, + "range": Array [ + 482, + 495, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 22, + "line": 26, + }, + "start": Object { + "column": 2, + "line": 26, + }, + }, + "range": Array [ + 476, + 496, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 27, + }, + "start": Object { + "column": 8, + "line": 27, + }, + }, + "name": "unique", + "optional": false, + "range": Array [ + 505, + 511, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 27, + }, + "start": Object { + "column": 17, + "line": 27, + }, + }, + "range": Array [ + 514, + 515, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 27, + }, + "start": Object { + "column": 8, + "line": 27, + }, + }, + "range": Array [ + 505, + 515, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 19, + "line": 27, + }, + "start": Object { + "column": 2, + "line": 27, + }, + }, + "range": Array [ + 499, + 516, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 28, + }, + "start": Object { + "column": 8, + "line": 28, + }, + }, + "name": "unknown", + "optional": false, + "range": Array [ + 525, + 532, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 28, + }, + "start": Object { + "column": 18, + "line": 28, + }, + }, + "range": Array [ + 535, + 536, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 28, + }, + "start": Object { + "column": 8, + "line": 28, + }, + }, + "range": Array [ + 525, + 536, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 20, + "line": 28, + }, + "start": Object { + "column": 2, + "line": 28, + }, + }, + "range": Array [ + 519, + 537, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 29, + }, + "start": Object { + "column": 8, + "line": 29, + }, + }, + "name": "from", + "optional": false, + "range": Array [ + 546, + 550, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 29, + }, + "start": Object { + "column": 15, + "line": 29, + }, + }, + "range": Array [ + 553, + 554, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 29, + }, + "start": Object { + "column": 8, + "line": 29, + }, + }, + "range": Array [ + 546, + 554, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 17, + "line": 29, + }, + "start": Object { + "column": 2, + "line": 29, + }, + }, + "range": Array [ + 540, + 555, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 30, + }, + "start": Object { + "column": 8, + "line": 30, + }, + }, + "name": "global", + "optional": false, + "range": Array [ + 564, + 570, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 30, + }, + "start": Object { + "column": 17, + "line": 30, + }, + }, + "range": Array [ + 573, + 574, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 30, + }, + "start": Object { + "column": 8, + "line": 30, + }, + }, + "range": Array [ + 564, + 574, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 19, + "line": 30, + }, + "start": Object { + "column": 2, + "line": 30, + }, + }, + "range": Array [ + 558, + 575, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 31, + }, + "start": Object { + "column": 8, + "line": 31, + }, + }, + "name": "bigint", + "optional": false, + "range": Array [ + 584, + 590, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 31, + }, + "start": Object { + "column": 17, + "line": 31, + }, + }, + "range": Array [ + 593, + 594, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 31, + }, + "start": Object { + "column": 8, + "line": 31, + }, + }, + "range": Array [ + 584, + 594, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 19, + "line": 31, + }, + "start": Object { + "column": 2, + "line": 31, + }, + }, + "range": Array [ + 578, + 595, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 32, + }, + "start": Object { + "column": 8, + "line": 32, + }, + }, + "name": "of", + "optional": false, + "range": Array [ + 604, + 606, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 32, + }, + "start": Object { + "column": 13, + "line": 32, + }, + }, + "range": Array [ + 609, + 610, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 32, + }, + "start": Object { + "column": 8, + "line": 32, + }, + }, + "range": Array [ + 604, + 610, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 15, + "line": 32, + }, + "start": Object { + "column": 2, + "line": 32, + }, + }, + "range": Array [ + 598, + 611, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 33, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 613, + ], + "type": "BlockStatement", + }, + Object { + "assertions": Array [], + "importKind": "value", + "loc": Object { + "end": Object { + "column": 21, + "line": 67, + }, + "start": Object { + "column": 0, + "line": 35, + }, + }, + "range": Array [ + 615, + 945, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 67, + }, + "start": Object { + "column": 7, + "line": 67, + }, + }, + "range": Array [ + 931, + 944, + ], + "raw": "'fake-module'", + "type": "Literal", + "value": "fake-module", + }, + "specifiers": Array [ + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 36, + }, + "start": Object { + "column": 2, + "line": 36, + }, + }, + "name": "abstract", + "optional": false, + "range": Array [ + 626, + 634, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 36, + }, + "start": Object { + "column": 2, + "line": 36, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 36, + }, + "start": Object { + "column": 2, + "line": 36, + }, + }, + "name": "abstract", + "optional": false, + "range": Array [ + 626, + 634, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 626, + 634, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 37, + }, + "start": Object { + "column": 2, + "line": 37, + }, + }, + "name": "as", + "optional": false, + "range": Array [ + 638, + 640, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 37, + }, + "start": Object { + "column": 2, + "line": 37, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 37, + }, + "start": Object { + "column": 2, + "line": 37, + }, + }, + "name": "as", + "optional": false, + "range": Array [ + 638, + 640, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 638, + 640, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 38, + }, + "start": Object { + "column": 2, + "line": 38, + }, + }, + "name": "asserts", + "optional": false, + "range": Array [ + 644, + 651, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 38, + }, + "start": Object { + "column": 2, + "line": 38, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 38, + }, + "start": Object { + "column": 2, + "line": 38, + }, + }, + "name": "asserts", + "optional": false, + "range": Array [ + 644, + 651, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 644, + 651, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 39, + }, + "start": Object { + "column": 2, + "line": 39, + }, + }, + "name": "any", + "optional": false, + "range": Array [ + 655, + 658, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 39, + }, + "start": Object { + "column": 2, + "line": 39, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 39, + }, + "start": Object { + "column": 2, + "line": 39, + }, + }, + "name": "any", + "optional": false, + "range": Array [ + 655, + 658, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 655, + 658, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 40, + }, + "start": Object { + "column": 2, + "line": 40, + }, + }, + "name": "async", + "optional": false, + "range": Array [ + 662, + 667, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 40, + }, + "start": Object { + "column": 2, + "line": 40, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 40, + }, + "start": Object { + "column": 2, + "line": 40, + }, + }, + "name": "async", + "optional": false, + "range": Array [ + 662, + 667, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 662, + 667, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 41, + }, + "start": Object { + "column": 2, + "line": 41, + }, + }, + "name": "await", + "optional": false, + "range": Array [ + 671, + 676, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 41, + }, + "start": Object { + "column": 2, + "line": 41, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 41, + }, + "start": Object { + "column": 2, + "line": 41, + }, + }, + "name": "await", + "optional": false, + "range": Array [ + 671, + 676, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 671, + 676, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 42, + }, + "start": Object { + "column": 2, + "line": 42, + }, + }, + "name": "boolean", + "optional": false, + "range": Array [ + 680, + 687, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 42, + }, + "start": Object { + "column": 2, + "line": 42, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 42, + }, + "start": Object { + "column": 2, + "line": 42, + }, + }, + "name": "boolean", + "optional": false, + "range": Array [ + 680, + 687, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 680, + 687, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 43, + }, + "start": Object { + "column": 2, + "line": 43, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 691, + 702, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 43, + }, + "start": Object { + "column": 2, + "line": 43, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 43, + }, + "start": Object { + "column": 2, + "line": 43, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 691, + 702, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 691, + 702, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 44, + }, + "start": Object { + "column": 2, + "line": 44, + }, + }, + "name": "declare", + "optional": false, + "range": Array [ + 706, + 713, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 44, + }, + "start": Object { + "column": 2, + "line": 44, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 44, + }, + "start": Object { + "column": 2, + "line": 44, + }, + }, + "name": "declare", + "optional": false, + "range": Array [ + 706, + 713, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 706, + 713, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 45, + }, + "start": Object { + "column": 2, + "line": 45, + }, + }, + "name": "get", + "optional": false, + "range": Array [ + 717, + 720, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 45, + }, + "start": Object { + "column": 2, + "line": 45, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 45, + }, + "start": Object { + "column": 2, + "line": 45, + }, + }, + "name": "get", + "optional": false, + "range": Array [ + 717, + 720, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 717, + 720, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 46, + }, + "start": Object { + "column": 2, + "line": 46, + }, + }, + "name": "infer", + "optional": false, + "range": Array [ + 724, + 729, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 46, + }, + "start": Object { + "column": 2, + "line": 46, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 46, + }, + "start": Object { + "column": 2, + "line": 46, + }, + }, + "name": "infer", + "optional": false, + "range": Array [ + 724, + 729, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 724, + 729, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 47, + }, + "start": Object { + "column": 2, + "line": 47, + }, + }, + "name": "is", + "optional": false, + "range": Array [ + 733, + 735, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 47, + }, + "start": Object { + "column": 2, + "line": 47, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 47, + }, + "start": Object { + "column": 2, + "line": 47, + }, + }, + "name": "is", + "optional": false, + "range": Array [ + 733, + 735, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 733, + 735, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 48, + }, + "start": Object { + "column": 2, + "line": 48, + }, + }, + "name": "keyof", + "optional": false, + "range": Array [ + 739, + 744, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 48, + }, + "start": Object { + "column": 2, + "line": 48, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 48, + }, + "start": Object { + "column": 2, + "line": 48, + }, + }, + "name": "keyof", + "optional": false, + "range": Array [ + 739, + 744, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 739, + 744, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 49, + }, + "start": Object { + "column": 2, + "line": 49, + }, + }, + "name": "module", + "optional": false, + "range": Array [ + 748, + 754, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 49, + }, + "start": Object { + "column": 2, + "line": 49, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 49, + }, + "start": Object { + "column": 2, + "line": 49, + }, + }, + "name": "module", + "optional": false, + "range": Array [ + 748, + 754, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 748, + 754, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 50, + }, + "start": Object { + "column": 2, + "line": 50, + }, + }, + "name": "namespace", + "optional": false, + "range": Array [ + 758, + 767, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 50, + }, + "start": Object { + "column": 2, + "line": 50, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 50, + }, + "start": Object { + "column": 2, + "line": 50, + }, + }, + "name": "namespace", + "optional": false, + "range": Array [ + 758, + 767, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 758, + 767, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 51, + }, + "start": Object { + "column": 2, + "line": 51, + }, + }, + "name": "never", + "optional": false, + "range": Array [ + 771, + 776, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 51, + }, + "start": Object { + "column": 2, + "line": 51, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 51, + }, + "start": Object { + "column": 2, + "line": 51, + }, + }, + "name": "never", + "optional": false, + "range": Array [ + 771, + 776, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 771, + 776, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 52, + }, + "start": Object { + "column": 2, + "line": 52, + }, + }, + "name": "readonly", + "optional": false, + "range": Array [ + 780, + 788, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 52, + }, + "start": Object { + "column": 2, + "line": 52, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 52, + }, + "start": Object { + "column": 2, + "line": 52, + }, + }, + "name": "readonly", + "optional": false, + "range": Array [ + 780, + 788, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 780, + 788, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 53, + }, + "start": Object { + "column": 2, + "line": 53, + }, + }, + "name": "require", + "optional": false, + "range": Array [ + 792, + 799, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 53, + }, + "start": Object { + "column": 2, + "line": 53, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 53, + }, + "start": Object { + "column": 2, + "line": 53, + }, + }, + "name": "require", + "optional": false, + "range": Array [ + 792, + 799, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 792, + 799, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 54, + }, + "start": Object { + "column": 2, + "line": 54, + }, + }, + "name": "number", + "optional": false, + "range": Array [ + 803, + 809, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 54, + }, + "start": Object { + "column": 2, + "line": 54, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 54, + }, + "start": Object { + "column": 2, + "line": 54, + }, + }, + "name": "number", + "optional": false, + "range": Array [ + 803, + 809, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 803, + 809, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 55, + }, + "start": Object { + "column": 2, + "line": 55, + }, + }, + "name": "object", + "optional": false, + "range": Array [ + 813, + 819, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 55, + }, + "start": Object { + "column": 2, + "line": 55, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 55, + }, + "start": Object { + "column": 2, + "line": 55, + }, + }, + "name": "object", + "optional": false, + "range": Array [ + 813, + 819, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 813, + 819, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 56, + }, + "start": Object { + "column": 2, + "line": 56, + }, + }, + "name": "set", + "optional": false, + "range": Array [ + 823, + 826, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 56, + }, + "start": Object { + "column": 2, + "line": 56, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 56, + }, + "start": Object { + "column": 2, + "line": 56, + }, + }, + "name": "set", + "optional": false, + "range": Array [ + 823, + 826, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 823, + 826, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 57, + }, + "start": Object { + "column": 2, + "line": 57, + }, + }, + "name": "string", + "optional": false, + "range": Array [ + 830, + 836, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 57, + }, + "start": Object { + "column": 2, + "line": 57, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 57, + }, + "start": Object { + "column": 2, + "line": 57, + }, + }, + "name": "string", + "optional": false, + "range": Array [ + 830, + 836, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 830, + 836, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 58, + }, + "start": Object { + "column": 2, + "line": 58, + }, + }, + "name": "symbol", + "optional": false, + "range": Array [ + 840, + 846, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 58, + }, + "start": Object { + "column": 2, + "line": 58, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 58, + }, + "start": Object { + "column": 2, + "line": 58, + }, + }, + "name": "symbol", + "optional": false, + "range": Array [ + 840, + 846, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 840, + 846, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 59, + }, + "start": Object { + "column": 2, + "line": 59, + }, + }, + "name": "type", + "optional": false, + "range": Array [ + 850, + 854, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 59, + }, + "start": Object { + "column": 2, + "line": 59, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 59, + }, + "start": Object { + "column": 2, + "line": 59, + }, + }, + "name": "type", + "optional": false, + "range": Array [ + 850, + 854, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 850, + 854, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 60, + }, + "start": Object { + "column": 2, + "line": 60, + }, + }, + "name": "undefined", + "optional": false, + "range": Array [ + 858, + 867, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 60, + }, + "start": Object { + "column": 2, + "line": 60, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 60, + }, + "start": Object { + "column": 2, + "line": 60, + }, + }, + "name": "undefined", + "optional": false, + "range": Array [ + 858, + 867, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 858, + 867, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 61, + }, + "start": Object { + "column": 2, + "line": 61, + }, + }, + "name": "unique", + "optional": false, + "range": Array [ + 871, + 877, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 61, + }, + "start": Object { + "column": 2, + "line": 61, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 61, + }, + "start": Object { + "column": 2, + "line": 61, + }, + }, + "name": "unique", + "optional": false, + "range": Array [ + 871, + 877, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 871, + 877, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 62, + }, + "start": Object { + "column": 2, + "line": 62, + }, + }, + "name": "unknown", + "optional": false, + "range": Array [ + 881, + 888, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 62, + }, + "start": Object { + "column": 2, + "line": 62, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 62, + }, + "start": Object { + "column": 2, + "line": 62, + }, + }, + "name": "unknown", + "optional": false, + "range": Array [ + 881, + 888, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 881, + 888, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 63, + }, + "start": Object { + "column": 2, + "line": 63, + }, + }, + "name": "from", + "optional": false, + "range": Array [ + 892, + 896, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 63, + }, + "start": Object { + "column": 2, + "line": 63, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 63, + }, + "start": Object { + "column": 2, + "line": 63, + }, + }, + "name": "from", + "optional": false, + "range": Array [ + 892, + 896, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 892, + 896, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 64, + }, + "start": Object { + "column": 2, + "line": 64, + }, + }, + "name": "global", + "optional": false, + "range": Array [ + 900, + 906, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 64, + }, + "start": Object { + "column": 2, + "line": 64, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 64, + }, + "start": Object { + "column": 2, + "line": 64, + }, + }, + "name": "global", + "optional": false, + "range": Array [ + 900, + 906, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 900, + 906, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 65, + }, + "start": Object { + "column": 2, + "line": 65, + }, + }, + "name": "bigint", + "optional": false, + "range": Array [ + 910, + 916, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 65, + }, + "start": Object { + "column": 2, + "line": 65, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 65, + }, + "start": Object { + "column": 2, + "line": 65, + }, + }, + "name": "bigint", + "optional": false, + "range": Array [ + 910, + 916, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 910, + 916, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "value", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 66, + }, + "start": Object { + "column": 2, + "line": 66, + }, + }, + "name": "of", + "optional": false, + "range": Array [ + 920, + 922, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 66, + }, + "start": Object { + "column": 2, + "line": 66, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 66, + }, + "start": Object { + "column": 2, + "line": 66, + }, + }, + "name": "of", + "optional": false, + "range": Array [ + 920, + 922, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 920, + 922, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 69, + }, + "start": Object { + "column": 12, + "line": 69, + }, + }, + "range": Array [ + 959, + 961, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 69, + }, + "start": Object { + "column": 10, + "line": 69, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 957, + 958, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 69, + }, + "start": Object { + "column": 0, + "line": 69, + }, + }, + "range": Array [ + 947, + 961, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 71, + }, + "start": Object { + "column": 9, + "line": 71, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 994, + 995, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 15, + "line": 71, + }, + "start": Object { + "column": 2, + "line": 71, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 987, + 1000, + ], + "static": true, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 71, + }, + "start": Object { + "column": 13, + "line": 71, + }, + }, + "range": Array [ + 998, + 1000, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 71, + }, + "start": Object { + "column": 10, + "line": 71, + }, + }, + "params": Array [], + "range": Array [ + 995, + 1000, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": "private", + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 72, + }, + "start": Object { + "column": 10, + "line": 72, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 1011, + 1012, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 16, + "line": 72, + }, + "start": Object { + "column": 2, + "line": 72, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 1003, + 1017, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 72, + }, + "start": Object { + "column": 14, + "line": 72, + }, + }, + "range": Array [ + 1015, + 1017, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 72, + }, + "start": Object { + "column": 11, + "line": 72, + }, + }, + "params": Array [], + "range": Array [ + 1012, + 1017, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": "public", + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 73, + }, + "start": Object { + "column": 9, + "line": 73, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 1027, + 1028, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 15, + "line": 73, + }, + "start": Object { + "column": 2, + "line": 73, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 1020, + 1033, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 73, + }, + "start": Object { + "column": 13, + "line": 73, + }, + }, + "range": Array [ + 1031, + 1033, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 73, + }, + "start": Object { + "column": 10, + "line": 73, + }, + }, + "params": Array [], + "range": Array [ + 1028, + 1033, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": "protected", + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 74, + }, + "start": Object { + "column": 13, + "line": 74, + }, + }, + "name": "d", + "optional": false, + "range": Array [ + 1047, + 1048, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 76, + }, + "start": Object { + "column": 2, + "line": 74, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 1036, + 1075, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 75, + }, + "start": Object { + "column": 8, + "line": 75, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 1061, + 1062, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "argument": null, + "delegate": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 75, + }, + "start": Object { + "column": 12, + "line": 75, + }, + }, + "range": Array [ + 1065, + 1070, + ], + "type": "YieldExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 75, + }, + "start": Object { + "column": 8, + "line": 75, + }, + }, + "range": Array [ + 1061, + 1070, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 18, + "line": 75, + }, + "start": Object { + "column": 4, + "line": 75, + }, + }, + "range": Array [ + 1057, + 1071, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 76, + }, + "start": Object { + "column": 17, + "line": 74, + }, + }, + "range": Array [ + 1051, + 1075, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": true, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 76, + }, + "start": Object { + "column": 14, + "line": 74, + }, + }, + "params": Array [], + "range": Array [ + 1048, + 1075, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 77, + }, + "start": Object { + "column": 21, + "line": 70, + }, + }, + "range": Array [ + 983, + 1077, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 70, + }, + "start": Object { + "column": 6, + "line": 70, + }, + }, + "name": "C", + "optional": false, + "range": Array [ + 968, + 969, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 70, + }, + "start": Object { + "column": 19, + "line": 70, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 981, + 982, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 70, + }, + "start": Object { + "column": 19, + "line": 70, + }, + }, + "range": Array [ + 981, + 982, + ], + "type": "TSClassImplements", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 77, + }, + "start": Object { + "column": 0, + "line": 70, + }, + }, + "range": Array [ + 962, + 1077, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 78, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1078, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 4, + 9, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 10, + 18, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 26, + 31, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 32, + 34, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 42, + 47, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 48, + 55, + ], + "type": "Identifier", + "value": "asserts", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 63, + 68, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 69, + 72, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 80, + 85, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 86, + 91, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 99, + 104, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 105, + 110, + ], + "type": "Identifier", + "value": "await", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 7, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 118, + 123, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 124, + 131, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 8, + }, + "start": Object { + "column": 16, + "line": 8, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 8, + }, + "start": Object { + "column": 18, + "line": 8, + }, + }, + "range": Array [ + 134, + 135, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 8, + }, + "start": Object { + "column": 19, + "line": 8, + }, + }, + "range": Array [ + 135, + 136, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 139, + 144, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "range": Array [ + 145, + 156, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 9, + }, + "start": Object { + "column": 20, + "line": 9, + }, + }, + "range": Array [ + 157, + 158, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 9, + }, + "start": Object { + "column": 22, + "line": 9, + }, + }, + "range": Array [ + 159, + 160, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 9, + }, + "start": Object { + "column": 23, + "line": 9, + }, + }, + "range": Array [ + 160, + 161, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 164, + 169, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "range": Array [ + 170, + 177, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 10, + }, + "start": Object { + "column": 16, + "line": 10, + }, + }, + "range": Array [ + 178, + 179, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 10, + }, + "start": Object { + "column": 18, + "line": 10, + }, + }, + "range": Array [ + 180, + 181, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 10, + }, + "start": Object { + "column": 19, + "line": 10, + }, + }, + "range": Array [ + 181, + 182, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "range": Array [ + 185, + 190, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 11, + }, + "start": Object { + "column": 8, + "line": 11, + }, + }, + "range": Array [ + 191, + 194, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 11, + }, + "start": Object { + "column": 12, + "line": 11, + }, + }, + "range": Array [ + 195, + 196, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 11, + }, + "start": Object { + "column": 14, + "line": 11, + }, + }, + "range": Array [ + 197, + 198, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 11, + }, + "start": Object { + "column": 15, + "line": 11, + }, + }, + "range": Array [ + 198, + 199, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "range": Array [ + 202, + 207, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 12, + }, + "start": Object { + "column": 8, + "line": 12, + }, + }, + "range": Array [ + 208, + 213, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 12, + }, + "start": Object { + "column": 14, + "line": 12, + }, + }, + "range": Array [ + 214, + 215, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 12, + }, + "start": Object { + "column": 16, + "line": 12, + }, + }, + "range": Array [ + 216, + 217, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 12, + }, + "start": Object { + "column": 17, + "line": 12, + }, + }, + "range": Array [ + 217, + 218, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 13, + }, + "start": Object { + "column": 2, + "line": 13, + }, + }, + "range": Array [ + 221, + 226, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 13, + }, + "start": Object { + "column": 8, + "line": 13, + }, + }, + "range": Array [ + 227, + 229, + ], + "type": "Identifier", + "value": "is", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 13, + }, + "start": Object { + "column": 11, + "line": 13, + }, + }, + "range": Array [ + 230, + 231, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 13, + }, + "start": Object { + "column": 13, + "line": 13, + }, + }, + "range": Array [ + 232, + 233, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 13, + }, + "start": Object { + "column": 14, + "line": 13, + }, + }, + "range": Array [ + 233, + 234, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 14, + }, + "start": Object { + "column": 2, + "line": 14, + }, + }, + "range": Array [ + 237, + 242, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 14, + }, + "start": Object { + "column": 8, + "line": 14, + }, + }, + "range": Array [ + 243, + 248, + ], + "type": "Identifier", + "value": "keyof", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 14, + }, + "start": Object { + "column": 14, + "line": 14, + }, + }, + "range": Array [ + 249, + 250, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 14, + }, + "start": Object { + "column": 16, + "line": 14, + }, + }, + "range": Array [ + 251, + 252, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 14, + }, + "start": Object { + "column": 17, + "line": 14, + }, + }, + "range": Array [ + 252, + 253, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 15, + }, + "start": Object { + "column": 2, + "line": 15, + }, + }, + "range": Array [ + 256, + 261, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 15, + }, + "start": Object { + "column": 8, + "line": 15, + }, + }, + "range": Array [ + 262, + 268, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 15, + }, + "start": Object { + "column": 15, + "line": 15, + }, + }, + "range": Array [ + 269, + 270, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 15, + }, + "start": Object { + "column": 17, + "line": 15, + }, + }, + "range": Array [ + 271, + 272, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 15, + }, + "start": Object { + "column": 18, + "line": 15, + }, + }, + "range": Array [ + 272, + 273, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 16, + }, + "start": Object { + "column": 2, + "line": 16, + }, + }, + "range": Array [ + 276, + 281, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 16, + }, + "start": Object { + "column": 8, + "line": 16, + }, + }, + "range": Array [ + 282, + 291, + ], + "type": "Identifier", + "value": "namespace", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 16, + }, + "start": Object { + "column": 18, + "line": 16, + }, + }, + "range": Array [ + 292, + 293, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 16, + }, + "start": Object { + "column": 20, + "line": 16, + }, + }, + "range": Array [ + 294, + 295, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 16, + }, + "start": Object { + "column": 21, + "line": 16, + }, + }, + "range": Array [ + 295, + 296, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 17, + }, + "start": Object { + "column": 2, + "line": 17, + }, + }, + "range": Array [ + 299, + 304, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 17, + }, + "start": Object { + "column": 8, + "line": 17, + }, + }, + "range": Array [ + 305, + 310, + ], + "type": "Identifier", + "value": "never", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 17, + }, + "start": Object { + "column": 14, + "line": 17, + }, + }, + "range": Array [ + 311, + 312, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 17, + }, + "start": Object { + "column": 16, + "line": 17, + }, + }, + "range": Array [ + 313, + 314, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 17, + }, + "start": Object { + "column": 17, + "line": 17, + }, + }, + "range": Array [ + 314, + 315, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 18, + }, + "start": Object { + "column": 2, + "line": 18, + }, + }, + "range": Array [ + 318, + 323, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 18, + }, + "start": Object { + "column": 8, + "line": 18, + }, + }, + "range": Array [ + 324, + 332, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 18, + }, + "start": Object { + "column": 17, + "line": 18, + }, + }, + "range": Array [ + 333, + 334, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 18, + }, + "start": Object { + "column": 19, + "line": 18, + }, + }, + "range": Array [ + 335, + 336, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 18, + }, + "start": Object { + "column": 20, + "line": 18, + }, + }, + "range": Array [ + 336, + 337, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 19, + }, + "start": Object { + "column": 2, + "line": 19, + }, + }, + "range": Array [ + 340, + 345, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 19, + }, + "start": Object { + "column": 8, + "line": 19, + }, + }, + "range": Array [ + 346, + 353, + ], + "type": "Identifier", + "value": "require", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 19, + }, + "start": Object { + "column": 16, + "line": 19, + }, + }, + "range": Array [ + 354, + 355, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 19, + }, + "start": Object { + "column": 18, + "line": 19, + }, + }, + "range": Array [ + 356, + 357, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 19, + }, + "start": Object { + "column": 19, + "line": 19, + }, + }, + "range": Array [ + 357, + 358, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 20, + }, + "start": Object { + "column": 2, + "line": 20, + }, + }, + "range": Array [ + 361, + 366, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 20, + }, + "start": Object { + "column": 8, + "line": 20, + }, + }, + "range": Array [ + 367, + 373, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 20, + }, + "start": Object { + "column": 15, + "line": 20, + }, + }, + "range": Array [ + 374, + 375, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 20, + }, + "start": Object { + "column": 17, + "line": 20, + }, + }, + "range": Array [ + 376, + 377, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 20, + }, + "start": Object { + "column": 18, + "line": 20, + }, + }, + "range": Array [ + 377, + 378, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 21, + }, + "start": Object { + "column": 2, + "line": 21, + }, + }, + "range": Array [ + 381, + 386, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 21, + }, + "start": Object { + "column": 8, + "line": 21, + }, + }, + "range": Array [ + 387, + 393, + ], + "type": "Identifier", + "value": "object", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 21, + }, + "start": Object { + "column": 15, + "line": 21, + }, + }, + "range": Array [ + 394, + 395, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 21, + }, + "start": Object { + "column": 17, + "line": 21, + }, + }, + "range": Array [ + 396, + 397, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 21, + }, + "start": Object { + "column": 18, + "line": 21, + }, + }, + "range": Array [ + 397, + 398, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 22, + }, + "start": Object { + "column": 2, + "line": 22, + }, + }, + "range": Array [ + 401, + 406, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 22, + }, + "start": Object { + "column": 8, + "line": 22, + }, + }, + "range": Array [ + 407, + 410, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 22, + }, + "start": Object { + "column": 12, + "line": 22, + }, + }, + "range": Array [ + 411, + 412, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 22, + }, + "start": Object { + "column": 14, + "line": 22, + }, + }, + "range": Array [ + 413, + 414, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 22, + }, + "start": Object { + "column": 15, + "line": 22, + }, + }, + "range": Array [ + 414, + 415, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 23, + }, + "start": Object { + "column": 2, + "line": 23, + }, + }, + "range": Array [ + 418, + 423, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 23, + }, + "start": Object { + "column": 8, + "line": 23, + }, + }, + "range": Array [ + 424, + 430, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 23, + }, + "start": Object { + "column": 15, + "line": 23, + }, + }, + "range": Array [ + 431, + 432, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 23, + }, + "start": Object { + "column": 17, + "line": 23, + }, + }, + "range": Array [ + 433, + 434, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 23, + }, + "start": Object { + "column": 18, + "line": 23, + }, + }, + "range": Array [ + 434, + 435, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 24, + }, + "start": Object { + "column": 2, + "line": 24, + }, + }, + "range": Array [ + 438, + 443, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 24, + }, + "start": Object { + "column": 8, + "line": 24, + }, + }, + "range": Array [ + 444, + 450, + ], + "type": "Identifier", + "value": "symbol", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 24, + }, + "start": Object { + "column": 15, + "line": 24, + }, + }, + "range": Array [ + 451, + 452, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 24, + }, + "start": Object { + "column": 17, + "line": 24, + }, + }, + "range": Array [ + 453, + 454, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 24, + }, + "start": Object { + "column": 18, + "line": 24, + }, + }, + "range": Array [ + 454, + 455, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 25, + }, + "start": Object { + "column": 2, + "line": 25, + }, + }, + "range": Array [ + 458, + 463, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 25, + }, + "start": Object { + "column": 8, + "line": 25, + }, + }, + "range": Array [ + 464, + 468, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 25, + }, + "start": Object { + "column": 13, + "line": 25, + }, + }, + "range": Array [ + 469, + 470, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 25, + }, + "start": Object { + "column": 15, + "line": 25, + }, + }, + "range": Array [ + 471, + 472, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 25, + }, + "start": Object { + "column": 16, + "line": 25, + }, + }, + "range": Array [ + 472, + 473, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 26, + }, + "start": Object { + "column": 2, + "line": 26, + }, + }, + "range": Array [ + 476, + 481, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 26, + }, + "start": Object { + "column": 8, + "line": 26, + }, + }, + "range": Array [ + 482, + 491, + ], + "type": "Identifier", + "value": "undefined", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 26, + }, + "start": Object { + "column": 18, + "line": 26, + }, + }, + "range": Array [ + 492, + 493, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 26, + }, + "start": Object { + "column": 20, + "line": 26, + }, + }, + "range": Array [ + 494, + 495, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 26, + }, + "start": Object { + "column": 21, + "line": 26, + }, + }, + "range": Array [ + 495, + 496, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 27, + }, + "start": Object { + "column": 2, + "line": 27, + }, + }, + "range": Array [ + 499, + 504, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 27, + }, + "start": Object { + "column": 8, + "line": 27, + }, + }, + "range": Array [ + 505, + 511, + ], + "type": "Identifier", + "value": "unique", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 27, + }, + "start": Object { + "column": 15, + "line": 27, + }, + }, + "range": Array [ + 512, + 513, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 27, + }, + "start": Object { + "column": 17, + "line": 27, + }, + }, + "range": Array [ + 514, + 515, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 27, + }, + "start": Object { + "column": 18, + "line": 27, + }, + }, + "range": Array [ + 515, + 516, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 28, + }, + "start": Object { + "column": 2, + "line": 28, + }, + }, + "range": Array [ + 519, + 524, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 28, + }, + "start": Object { + "column": 8, + "line": 28, + }, + }, + "range": Array [ + 525, + 532, + ], + "type": "Identifier", + "value": "unknown", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 28, + }, + "start": Object { + "column": 16, + "line": 28, + }, + }, + "range": Array [ + 533, + 534, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 28, + }, + "start": Object { + "column": 18, + "line": 28, + }, + }, + "range": Array [ + 535, + 536, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 28, + }, + "start": Object { + "column": 19, + "line": 28, + }, + }, + "range": Array [ + 536, + 537, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 29, + }, + "start": Object { + "column": 2, + "line": 29, + }, + }, + "range": Array [ + 540, + 545, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 29, + }, + "start": Object { + "column": 8, + "line": 29, + }, + }, + "range": Array [ + 546, + 550, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 29, + }, + "start": Object { + "column": 13, + "line": 29, + }, + }, + "range": Array [ + 551, + 552, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 29, + }, + "start": Object { + "column": 15, + "line": 29, + }, + }, + "range": Array [ + 553, + 554, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 29, + }, + "start": Object { + "column": 16, + "line": 29, + }, + }, + "range": Array [ + 554, + 555, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 30, + }, + "start": Object { + "column": 2, + "line": 30, + }, + }, + "range": Array [ + 558, + 563, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 30, + }, + "start": Object { + "column": 8, + "line": 30, + }, + }, + "range": Array [ + 564, + 570, + ], + "type": "Identifier", + "value": "global", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 30, + }, + "start": Object { + "column": 15, + "line": 30, + }, + }, + "range": Array [ + 571, + 572, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 30, + }, + "start": Object { + "column": 17, + "line": 30, + }, + }, + "range": Array [ + 573, + 574, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 30, + }, + "start": Object { + "column": 18, + "line": 30, + }, + }, + "range": Array [ + 574, + 575, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 31, + }, + "start": Object { + "column": 2, + "line": 31, + }, + }, + "range": Array [ + 578, + 583, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 31, + }, + "start": Object { + "column": 8, + "line": 31, + }, + }, + "range": Array [ + 584, + 590, + ], + "type": "Identifier", + "value": "bigint", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 31, + }, + "start": Object { + "column": 15, + "line": 31, + }, + }, + "range": Array [ + 591, + 592, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 31, + }, + "start": Object { + "column": 17, + "line": 31, + }, + }, + "range": Array [ + 593, + 594, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 31, + }, + "start": Object { + "column": 18, + "line": 31, + }, + }, + "range": Array [ + 594, + 595, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 32, + }, + "start": Object { + "column": 2, + "line": 32, + }, + }, + "range": Array [ + 598, + 603, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 32, + }, + "start": Object { + "column": 8, + "line": 32, + }, + }, + "range": Array [ + 604, + 606, + ], + "type": "Identifier", + "value": "of", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 32, + }, + "start": Object { + "column": 11, + "line": 32, + }, + }, + "range": Array [ + 607, + 608, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 32, + }, + "start": Object { + "column": 13, + "line": 32, + }, + }, + "range": Array [ + 609, + 610, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 32, + }, + "start": Object { + "column": 14, + "line": 32, + }, + }, + "range": Array [ + 610, + 611, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 33, + }, + "start": Object { + "column": 0, + "line": 33, + }, + }, + "range": Array [ + 612, + 613, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 35, + }, + "start": Object { + "column": 0, + "line": 35, + }, + }, + "range": Array [ + 615, + 621, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 35, + }, + "start": Object { + "column": 7, + "line": 35, + }, + }, + "range": Array [ + 622, + 623, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 36, + }, + "start": Object { + "column": 2, + "line": 36, + }, + }, + "range": Array [ + 626, + 634, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 36, + }, + "start": Object { + "column": 10, + "line": 36, + }, + }, + "range": Array [ + 634, + 635, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 37, + }, + "start": Object { + "column": 2, + "line": 37, + }, + }, + "range": Array [ + 638, + 640, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 37, + }, + "start": Object { + "column": 4, + "line": 37, + }, + }, + "range": Array [ + 640, + 641, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 38, + }, + "start": Object { + "column": 2, + "line": 38, + }, + }, + "range": Array [ + 644, + 651, + ], + "type": "Identifier", + "value": "asserts", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 38, + }, + "start": Object { + "column": 9, + "line": 38, + }, + }, + "range": Array [ + 651, + 652, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 39, + }, + "start": Object { + "column": 2, + "line": 39, + }, + }, + "range": Array [ + 655, + 658, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 39, + }, + "start": Object { + "column": 5, + "line": 39, + }, + }, + "range": Array [ + 658, + 659, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 40, + }, + "start": Object { + "column": 2, + "line": 40, + }, + }, + "range": Array [ + 662, + 667, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 40, + }, + "start": Object { + "column": 7, + "line": 40, + }, + }, + "range": Array [ + 667, + 668, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 41, + }, + "start": Object { + "column": 2, + "line": 41, + }, + }, + "range": Array [ + 671, + 676, + ], + "type": "Identifier", + "value": "await", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 41, + }, + "start": Object { + "column": 7, + "line": 41, + }, + }, + "range": Array [ + 676, + 677, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 42, + }, + "start": Object { + "column": 2, + "line": 42, + }, + }, + "range": Array [ + 680, + 687, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 42, + }, + "start": Object { + "column": 9, + "line": 42, + }, + }, + "range": Array [ + 687, + 688, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 43, + }, + "start": Object { + "column": 2, + "line": 43, + }, + }, + "range": Array [ + 691, + 702, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 43, + }, + "start": Object { + "column": 13, + "line": 43, + }, + }, + "range": Array [ + 702, + 703, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 44, + }, + "start": Object { + "column": 2, + "line": 44, + }, + }, + "range": Array [ + 706, + 713, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 44, + }, + "start": Object { + "column": 9, + "line": 44, + }, + }, + "range": Array [ + 713, + 714, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 45, + }, + "start": Object { + "column": 2, + "line": 45, + }, + }, + "range": Array [ + 717, + 720, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 45, + }, + "start": Object { + "column": 5, + "line": 45, + }, + }, + "range": Array [ + 720, + 721, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 46, + }, + "start": Object { + "column": 2, + "line": 46, + }, + }, + "range": Array [ + 724, + 729, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 46, + }, + "start": Object { + "column": 7, + "line": 46, + }, + }, + "range": Array [ + 729, + 730, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 47, + }, + "start": Object { + "column": 2, + "line": 47, + }, + }, + "range": Array [ + 733, + 735, + ], + "type": "Identifier", + "value": "is", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 47, + }, + "start": Object { + "column": 4, + "line": 47, + }, + }, + "range": Array [ + 735, + 736, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 48, + }, + "start": Object { + "column": 2, + "line": 48, + }, + }, + "range": Array [ + 739, + 744, + ], + "type": "Identifier", + "value": "keyof", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 48, + }, + "start": Object { + "column": 7, + "line": 48, + }, + }, + "range": Array [ + 744, + 745, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 49, + }, + "start": Object { + "column": 2, + "line": 49, + }, + }, + "range": Array [ + 748, + 754, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 49, + }, + "start": Object { + "column": 8, + "line": 49, + }, + }, + "range": Array [ + 754, + 755, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 50, + }, + "start": Object { + "column": 2, + "line": 50, + }, + }, + "range": Array [ + 758, + 767, + ], + "type": "Identifier", + "value": "namespace", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 50, + }, + "start": Object { + "column": 11, + "line": 50, + }, + }, + "range": Array [ + 767, + 768, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 51, + }, + "start": Object { + "column": 2, + "line": 51, + }, + }, + "range": Array [ + 771, + 776, + ], + "type": "Identifier", + "value": "never", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 51, + }, + "start": Object { + "column": 7, + "line": 51, + }, + }, + "range": Array [ + 776, + 777, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 52, + }, + "start": Object { + "column": 2, + "line": 52, + }, + }, + "range": Array [ + 780, + 788, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 52, + }, + "start": Object { + "column": 10, + "line": 52, + }, + }, + "range": Array [ + 788, + 789, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 53, + }, + "start": Object { + "column": 2, + "line": 53, + }, + }, + "range": Array [ + 792, + 799, + ], + "type": "Identifier", + "value": "require", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 53, + }, + "start": Object { + "column": 9, + "line": 53, + }, + }, + "range": Array [ + 799, + 800, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 54, + }, + "start": Object { + "column": 2, + "line": 54, + }, + }, + "range": Array [ + 803, + 809, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 54, + }, + "start": Object { + "column": 8, + "line": 54, + }, + }, + "range": Array [ + 809, + 810, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 55, + }, + "start": Object { + "column": 2, + "line": 55, + }, + }, + "range": Array [ + 813, + 819, + ], + "type": "Identifier", + "value": "object", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 55, + }, + "start": Object { + "column": 8, + "line": 55, + }, + }, + "range": Array [ + 819, + 820, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 56, + }, + "start": Object { + "column": 2, + "line": 56, + }, + }, + "range": Array [ + 823, + 826, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 56, + }, + "start": Object { + "column": 5, + "line": 56, + }, + }, + "range": Array [ + 826, + 827, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 57, + }, + "start": Object { + "column": 2, + "line": 57, + }, + }, + "range": Array [ + 830, + 836, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 57, + }, + "start": Object { + "column": 8, + "line": 57, + }, + }, + "range": Array [ + 836, + 837, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 58, + }, + "start": Object { + "column": 2, + "line": 58, + }, + }, + "range": Array [ + 840, + 846, + ], + "type": "Identifier", + "value": "symbol", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 58, + }, + "start": Object { + "column": 8, + "line": 58, + }, + }, + "range": Array [ + 846, + 847, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 59, + }, + "start": Object { + "column": 2, + "line": 59, + }, + }, + "range": Array [ + 850, + 854, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 59, + }, + "start": Object { + "column": 6, + "line": 59, + }, + }, + "range": Array [ + 854, + 855, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 60, + }, + "start": Object { + "column": 2, + "line": 60, + }, + }, + "range": Array [ + 858, + 867, + ], + "type": "Identifier", + "value": "undefined", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 60, + }, + "start": Object { + "column": 11, + "line": 60, + }, + }, + "range": Array [ + 867, + 868, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 61, + }, + "start": Object { + "column": 2, + "line": 61, + }, + }, + "range": Array [ + 871, + 877, + ], + "type": "Identifier", + "value": "unique", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 61, + }, + "start": Object { + "column": 8, + "line": 61, + }, + }, + "range": Array [ + 877, + 878, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 62, + }, + "start": Object { + "column": 2, + "line": 62, + }, + }, + "range": Array [ + 881, + 888, + ], + "type": "Identifier", + "value": "unknown", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 62, + }, + "start": Object { + "column": 9, + "line": 62, + }, + }, + "range": Array [ + 888, + 889, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 63, + }, + "start": Object { + "column": 2, + "line": 63, + }, + }, + "range": Array [ + 892, + 896, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 63, + }, + "start": Object { + "column": 6, + "line": 63, + }, + }, + "range": Array [ + 896, + 897, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 64, + }, + "start": Object { + "column": 2, + "line": 64, + }, + }, + "range": Array [ + 900, + 906, + ], + "type": "Identifier", + "value": "global", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 64, + }, + "start": Object { + "column": 8, + "line": 64, + }, + }, + "range": Array [ + 906, + 907, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 65, + }, + "start": Object { + "column": 2, + "line": 65, + }, + }, + "range": Array [ + 910, + 916, + ], + "type": "Identifier", + "value": "bigint", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 65, + }, + "start": Object { + "column": 8, + "line": 65, + }, + }, + "range": Array [ + 916, + 917, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 66, + }, + "start": Object { + "column": 2, + "line": 66, + }, + }, + "range": Array [ + 920, + 922, + ], + "type": "Identifier", + "value": "of", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 66, + }, + "start": Object { + "column": 4, + "line": 66, + }, + }, + "range": Array [ + 922, + 923, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 67, + }, + "start": Object { + "column": 0, + "line": 67, + }, + }, + "range": Array [ + 924, + 925, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 67, + }, + "start": Object { + "column": 2, + "line": 67, + }, + }, + "range": Array [ + 926, + 930, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 67, + }, + "start": Object { + "column": 7, + "line": 67, + }, + }, + "range": Array [ + 931, + 944, + ], + "type": "String", + "value": "'fake-module'", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 67, + }, + "start": Object { + "column": 20, + "line": 67, + }, + }, + "range": Array [ + 944, + 945, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 69, + }, + "start": Object { + "column": 0, + "line": 69, + }, + }, + "range": Array [ + 947, + 956, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 69, + }, + "start": Object { + "column": 10, + "line": 69, + }, + }, + "range": Array [ + 957, + 958, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 69, + }, + "start": Object { + "column": 12, + "line": 69, + }, + }, + "range": Array [ + 959, + 960, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 69, + }, + "start": Object { + "column": 13, + "line": 69, + }, + }, + "range": Array [ + 960, + 961, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 70, + }, + "start": Object { + "column": 0, + "line": 70, + }, + }, + "range": Array [ + 962, + 967, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 70, + }, + "start": Object { + "column": 6, + "line": 70, + }, + }, + "range": Array [ + 968, + 969, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 70, + }, + "start": Object { + "column": 8, + "line": 70, + }, + }, + "range": Array [ + 970, + 980, + ], + "type": "Keyword", + "value": "implements", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 70, + }, + "start": Object { + "column": 19, + "line": 70, + }, + }, + "range": Array [ + 981, + 982, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 70, + }, + "start": Object { + "column": 21, + "line": 70, + }, + }, + "range": Array [ + 983, + 984, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 71, + }, + "start": Object { + "column": 2, + "line": 71, + }, + }, + "range": Array [ + 987, + 993, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 71, + }, + "start": Object { + "column": 9, + "line": 71, + }, + }, + "range": Array [ + 994, + 995, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 71, + }, + "start": Object { + "column": 10, + "line": 71, + }, + }, + "range": Array [ + 995, + 996, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 71, + }, + "start": Object { + "column": 11, + "line": 71, + }, + }, + "range": Array [ + 996, + 997, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 71, + }, + "start": Object { + "column": 13, + "line": 71, + }, + }, + "range": Array [ + 998, + 999, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 71, + }, + "start": Object { + "column": 14, + "line": 71, + }, + }, + "range": Array [ + 999, + 1000, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 72, + }, + "start": Object { + "column": 2, + "line": 72, + }, + }, + "range": Array [ + 1003, + 1010, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 72, + }, + "start": Object { + "column": 10, + "line": 72, + }, + }, + "range": Array [ + 1011, + 1012, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 72, + }, + "start": Object { + "column": 11, + "line": 72, + }, + }, + "range": Array [ + 1012, + 1013, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 72, + }, + "start": Object { + "column": 12, + "line": 72, + }, + }, + "range": Array [ + 1013, + 1014, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 72, + }, + "start": Object { + "column": 14, + "line": 72, + }, + }, + "range": Array [ + 1015, + 1016, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 72, + }, + "start": Object { + "column": 15, + "line": 72, + }, + }, + "range": Array [ + 1016, + 1017, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 73, + }, + "start": Object { + "column": 2, + "line": 73, + }, + }, + "range": Array [ + 1020, + 1026, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 73, + }, + "start": Object { + "column": 9, + "line": 73, + }, + }, + "range": Array [ + 1027, + 1028, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 73, + }, + "start": Object { + "column": 10, + "line": 73, + }, + }, + "range": Array [ + 1028, + 1029, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 73, + }, + "start": Object { + "column": 11, + "line": 73, + }, + }, + "range": Array [ + 1029, + 1030, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 73, + }, + "start": Object { + "column": 13, + "line": 73, + }, + }, + "range": Array [ + 1031, + 1032, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 73, + }, + "start": Object { + "column": 14, + "line": 73, + }, + }, + "range": Array [ + 1032, + 1033, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 74, + }, + "start": Object { + "column": 2, + "line": 74, + }, + }, + "range": Array [ + 1036, + 1045, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 74, + }, + "start": Object { + "column": 12, + "line": 74, + }, + }, + "range": Array [ + 1046, + 1047, + ], + "type": "Punctuator", + "value": "*", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 74, + }, + "start": Object { + "column": 13, + "line": 74, + }, + }, + "range": Array [ + 1047, + 1048, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 74, + }, + "start": Object { + "column": 14, + "line": 74, + }, + }, + "range": Array [ + 1048, + 1049, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 74, + }, + "start": Object { + "column": 15, + "line": 74, + }, + }, + "range": Array [ + 1049, + 1050, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 74, + }, + "start": Object { + "column": 17, + "line": 74, + }, + }, + "range": Array [ + 1051, + 1052, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 75, + }, + "start": Object { + "column": 4, + "line": 75, + }, + }, + "range": Array [ + 1057, + 1060, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 75, + }, + "start": Object { + "column": 8, + "line": 75, + }, + }, + "range": Array [ + 1061, + 1062, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 75, + }, + "start": Object { + "column": 10, + "line": 75, + }, + }, + "range": Array [ + 1063, + 1064, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 75, + }, + "start": Object { + "column": 12, + "line": 75, + }, + }, + "range": Array [ + 1065, + 1070, + ], + "type": "Keyword", + "value": "yield", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 75, + }, + "start": Object { + "column": 17, + "line": 75, + }, + }, + "range": Array [ + 1070, + 1071, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 76, + }, + "start": Object { + "column": 2, + "line": 76, + }, + }, + "range": Array [ + 1074, + 1075, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 77, + }, + "start": Object { + "column": 0, + "line": 77, + }, + }, + "range": Array [ + 1076, + 1077, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/nested-type-arguments.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/nested-type-arguments.src.ts.shot new file mode 100644 index 00000000000..57445e1681a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/nested-type-arguments.src.ts.shot @@ -0,0 +1,526 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics nested-type-arguments.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "nestedArray", + "optional": false, + "range": Array [ + 4, + 44, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 44, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 44, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "Array", + "optional": false, + "range": Array [ + 17, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 43, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "Array", + "optional": false, + "range": Array [ + 23, + 28, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 42, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "Array", + "optional": false, + "range": Array [ + 29, + 34, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "TSStringKeyword", + }, + ], + "range": Array [ + 34, + 42, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + ], + "range": Array [ + 28, + 43, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + ], + "range": Array [ + 22, + 44, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 44, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 15, + ], + "type": "Identifier", + "value": "nestedArray", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 22, + ], + "type": "Identifier", + "value": "Array", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 28, + ], + "type": "Identifier", + "value": "Array", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 34, + ], + "type": "Identifier", + "value": "Array", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/never-type-param.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/never-type-param.src.ts.shot new file mode 100644 index 00000000000..6d84c412d33 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/never-type-param.src.ts.shot @@ -0,0 +1,618 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics never-type-param.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 15, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 15, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "TSNeverKeyword", + }, + ], + "range": Array [ + 8, + 15, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 15, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "VariableDeclaration", + }, + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "name": "Observable", + "optional": false, + "range": Array [ + 17, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "empty", + "optional": false, + "range": Array [ + 28, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 17, + 33, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 17, + 42, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 34, + 39, + ], + "type": "TSNeverKeyword", + }, + ], + "range": Array [ + 33, + 40, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 17, + 43, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Identifier", + "value": "never", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 17, + 27, + ], + "type": "Identifier", + "value": "Observable", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 28, + 33, + ], + "type": "Identifier", + "value": "empty", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 34, + 39, + ], + "type": "Identifier", + "value": "never", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/new-target-in-arrow-function-body.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/new-target-in-arrow-function-body.src.ts.shot new file mode 100644 index 00000000000..3326909cd75 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/new-target-in-arrow-function-body.src.ts.shot @@ -0,0 +1,350 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics new-target-in-arrow-function-body.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "meta": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "new", + "optional": false, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "target", + "optional": false, + "range": Array [ + 20, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 16, + 26, + ], + "type": "MetaProperty", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 10, + 26, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 26, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 15, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 26, + ], + "type": "Identifier", + "value": "target", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/non-null-assertion-operator.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/non-null-assertion-operator.src.ts.shot new file mode 100644 index 00000000000..6d2102b8086 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/non-null-assertion-operator.src.ts.shot @@ -0,0 +1,801 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics non-null-assertion-operator.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "name": "e", + "optional": false, + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "validateEntity", + "optional": false, + "range": Array [ + 41, + 55, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 41, + 58, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 41, + 59, + ], + "type": "ExpressionStatement", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "s", + "optional": false, + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "object": Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "name": "e", + "optional": false, + "range": Array [ + 72, + 73, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 72, + 74, + ], + "type": "TSNonNullExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "name", + "optional": false, + "range": Array [ + 75, + 79, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 72, + 79, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 68, + 79, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 64, + 80, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 82, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processEntity", + "optional": false, + "range": Array [ + 9, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "e", + "optional": true, + "range": Array [ + 23, + 33, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 33, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": "Entity", + "optional": false, + "range": Array [ + 27, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 0, + 82, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 82, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 22, + ], + "type": "Identifier", + "value": "processEntity", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "Identifier", + "value": "Entity", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 41, + 55, + ], + "type": "Identifier", + "value": "validateEntity", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 64, + 67, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + "value": "s", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/null-and-undefined-type-annotations.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/null-and-undefined-type-annotations.src.ts.shot new file mode 100644 index 00000000000..38a5dee4492 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/null-and-undefined-type-annotations.src.ts.shot @@ -0,0 +1,395 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics null-and-undefined-type-annotations.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 11, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "TSNullKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 11, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 17, + 29, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 18, + 29, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 20, + 29, + ], + "type": "TSUndefinedKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 29, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 13, + 30, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Keyword", + "value": "null", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 20, + 29, + ], + "type": "Identifier", + "value": "undefined", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/nullish-coalescing.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/nullish-coalescing.src.ts.shot new file mode 100644 index 00000000000..6d53507132c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/nullish-coalescing.src.ts.shot @@ -0,0 +1,606 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics nullish-coalescing.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "len", + "optional": false, + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "s", + "optional": false, + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "operator": "??", + "range": Array [ + 59, + 66, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 64, + 66, + ], + "raw": "''", + "type": "Literal", + "value": "", + }, + "type": "LogicalExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 52, + 67, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 48, + 68, + ], + "type": "VariableDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 70, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processNullishCoalesce", + "optional": false, + "range": Array [ + 9, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "name": "s", + "optional": true, + "range": Array [ + 32, + 42, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 70, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 71, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 31, + ], + "type": "Identifier", + "value": "processNullishCoalesce", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "s", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 48, + 51, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + "value": "len", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + "value": "s", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 61, + 63, + ], + "type": "Punctuator", + "value": "??", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 64, + 66, + ], + "type": "String", + "value": "''", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/object-with-escaped-properties.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/object-with-escaped-properties.src.ts.shot new file mode 100644 index 00000000000..d8889f407b3 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/object-with-escaped-properties.src.ts.shot @@ -0,0 +1,1101 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics object-with-escaped-properties.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 7, + ], + "raw": "'__'", + "type": "Literal", + "value": "__", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 3, + 13, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "raw": "null", + "type": "Literal", + "value": null, + }, + }, + ], + "range": Array [ + 1, + 15, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 22, + 26, + ], + "raw": "'__'", + "type": "Literal", + "value": "__", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "method": true, + "optional": false, + "range": Array [ + 22, + 31, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 26, + 31, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "range": Array [ + 20, + 33, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 19, + 35, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "properties": Array [ + Object { + "computed": true, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 41, + 45, + ], + "raw": "'__'", + "type": "Literal", + "value": "__", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 40, + 52, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 48, + 52, + ], + "raw": "null", + "type": "Literal", + "value": null, + }, + }, + ], + "range": Array [ + 38, + 54, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 37, + 56, + ], + "type": "ExpressionStatement", + }, + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 68, + 72, + ], + "raw": "'__'", + "type": "Literal", + "value": "__", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 68, + 79, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 75, + 79, + ], + "raw": "null", + "type": "Literal", + "value": null, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 66, + 81, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 64, + 65, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 58, + 81, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 82, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 7, + ], + "type": "String", + "value": "'__'", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "type": "Keyword", + "value": "null", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 22, + 26, + ], + "type": "String", + "value": "'__'", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 41, + 45, + ], + "type": "String", + "value": "'__'", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 48, + 52, + ], + "type": "Keyword", + "value": "null", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 58, + 63, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 68, + 72, + ], + "type": "String", + "value": "'__'", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 7, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "Keyword", + "value": "null", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 22, + "line": 7, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/object-with-typed-methods.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/object-with-typed-methods.src.ts.shot new file mode 100644 index 00000000000..83b6c9fc83d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/object-with-typed-methods.src.ts.shot @@ -0,0 +1,1838 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics object-with-typed-methods.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 16, + 29, + ], + "raw": "\\"constructor\\"", + "type": "Literal", + "value": "constructor", + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "method": true, + "optional": false, + "range": Array [ + 16, + 61, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 49, + 57, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 43, + 61, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 29, + 61, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 34, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 30, + 31, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 29, + 32, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 65, + 68, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "method": true, + "optional": false, + "range": Array [ + 65, + 100, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 95, + 96, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 88, + 96, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 82, + 100, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "params": Array [], + "range": Array [ + 68, + 100, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 73, + 81, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 75, + 81, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 69, + 70, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 68, + 71, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 8, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 108, + 109, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 104, + 138, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 11, + "line": 9, + }, + }, + "range": Array [ + 133, + 134, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 126, + 134, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 18, + "line": 8, + }, + }, + "range": Array [ + 120, + 138, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "params": Array [], + "range": Array [ + 109, + 138, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "range": Array [ + 111, + 119, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "range": Array [ + 113, + 119, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 11, + }, + "start": Object { + "column": 6, + "line": 11, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 146, + 147, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 3, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 142, + 172, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 12, + }, + "start": Object { + "column": 27, + "line": 11, + }, + }, + "range": Array [ + 167, + 172, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 12, + }, + "start": Object { + "column": 7, + "line": 11, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 8, + "line": 11, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 148, + 157, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 9, + "line": 11, + }, + }, + "range": Array [ + 149, + 157, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 11, + "line": 11, + }, + }, + "range": Array [ + 151, + 157, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 147, + 172, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 11, + }, + "start": Object { + "column": 18, + "line": 11, + }, + }, + "range": Array [ + 158, + 166, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 11, + }, + "start": Object { + "column": 20, + "line": 11, + }, + }, + "range": Array [ + 160, + 166, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "range": Array [ + 12, + 174, + ], + "type": "ObjectExpression", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 174, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 2, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 175, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 14, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 176, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 16, + 29, + ], + "type": "String", + "value": "\\"constructor\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 49, + 55, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 65, + 68, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 75, + 81, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 88, + 94, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 99, + 100, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 104, + 107, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 8, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "range": Array [ + 113, + 119, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 8, + }, + "start": Object { + "column": 18, + "line": 8, + }, + }, + "range": Array [ + 120, + 121, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 126, + 132, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 11, + "line": 9, + }, + }, + "range": Array [ + 133, + 134, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 137, + 138, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 10, + }, + "start": Object { + "column": 3, + "line": 10, + }, + }, + "range": Array [ + 138, + 139, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 2, + "line": 11, + }, + }, + "range": Array [ + 142, + 145, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 11, + }, + "start": Object { + "column": 6, + "line": 11, + }, + }, + "range": Array [ + 146, + 147, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 11, + }, + "start": Object { + "column": 7, + "line": 11, + }, + }, + "range": Array [ + 147, + 148, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 11, + }, + "start": Object { + "column": 8, + "line": 11, + }, + }, + "range": Array [ + 148, + 149, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 11, + }, + "start": Object { + "column": 9, + "line": 11, + }, + }, + "range": Array [ + 149, + 150, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 11, + }, + "start": Object { + "column": 11, + "line": 11, + }, + }, + "range": Array [ + 151, + 157, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 11, + }, + "start": Object { + "column": 17, + "line": 11, + }, + }, + "range": Array [ + 157, + 158, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 11, + }, + "start": Object { + "column": 18, + "line": 11, + }, + }, + "range": Array [ + 158, + 159, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 11, + }, + "start": Object { + "column": 20, + "line": 11, + }, + }, + "range": Array [ + 160, + 166, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 11, + }, + "start": Object { + "column": 27, + "line": 11, + }, + }, + "range": Array [ + 167, + 168, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "range": Array [ + 171, + 172, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 13, + }, + }, + "range": Array [ + 173, + 174, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 13, + }, + "start": Object { + "column": 1, + "line": 13, + }, + }, + "range": Array [ + 174, + 175, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-call-with-non-null-assertion.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-call-with-non-null-assertion.src.ts.shot new file mode 100644 index 00000000000..95c6baf56da --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-call-with-non-null-assertion.src.ts.shot @@ -0,0 +1,2252 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics optional-chain-call-with-non-null-assertion.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 45, + 48, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 40, + 48, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 40, + 49, + ], + "type": "TSNonNullExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 40, + 51, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 40, + 51, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 40, + 52, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 55, + 58, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 60, + 63, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 55, + 63, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 55, + 64, + ], + "type": "TSNonNullExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 55, + 70, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "range": Array [ + 55, + 72, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 55, + 72, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 55, + 73, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 77, + 80, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 82, + 85, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 77, + 85, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 77, + 85, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 76, + 87, + ], + "type": "TSNonNullExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 76, + 89, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 76, + 90, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 94, + 97, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 99, + 102, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 94, + 102, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 94, + 102, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 93, + 104, + ], + "type": "TSNonNullExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 105, + 110, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 93, + 110, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "optional": false, + "range": Array [ + 93, + 112, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 93, + 113, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 117, + 120, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 117, + 125, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 117, + 126, + ], + "type": "TSNonNullExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 117, + 126, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "optional": false, + "range": Array [ + 116, + 129, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 116, + 130, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "object": Object { + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 134, + 137, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 139, + 142, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 134, + 142, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "range": Array [ + 134, + 143, + ], + "type": "TSNonNullExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "range": Array [ + 134, + 143, + ], + "type": "ChainExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 145, + 150, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 133, + 150, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "optional": false, + "range": Array [ + 133, + 152, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 133, + 153, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 155, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processOptional", + "optional": false, + "range": Array [ + 9, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "one", + "optional": true, + "range": Array [ + 25, + 34, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 34, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 155, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 156, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 24, + ], + "type": "Identifier", + "value": "processOptional", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 43, + 45, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 45, + 48, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 55, + 58, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 58, + 60, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 60, + 63, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 77, + 80, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 80, + 82, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 82, + 85, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 87, + 88, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 94, + 97, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 97, + 99, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 99, + 102, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 104, + 105, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 105, + 110, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 21, + "line": 5, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 117, + 120, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 120, + 122, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 125, + 126, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 126, + 127, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 127, + 128, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 128, + 129, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 15, + "line": 6, + }, + }, + "range": Array [ + 129, + 130, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 133, + 134, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "range": Array [ + 134, + 137, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 137, + 139, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 139, + 142, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 142, + 143, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 143, + 144, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 144, + 145, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 145, + 150, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 7, + }, + "start": Object { + "column": 19, + "line": 7, + }, + }, + "range": Array [ + 150, + 151, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 151, + 152, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 7, + }, + "start": Object { + "column": 21, + "line": 7, + }, + }, + "range": Array [ + 152, + 153, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-call-with-parens.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-call-with-parens.src.ts.shot new file mode 100644 index 00000000000..389216de89c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-call-with-parens.src.ts.shot @@ -0,0 +1,3113 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics optional-chain-call-with-parens.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 51, + 54, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": "fn", + "optional": false, + "range": Array [ + 56, + 58, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 51, + 58, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 51, + 60, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 51, + 60, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 50, + 62, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 66, + 69, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 71, + 74, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 66, + 74, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 66, + 74, + ], + "type": "ChainExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "fn", + "optional": false, + "range": Array [ + 76, + 78, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 65, + 78, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "range": Array [ + 65, + 80, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 65, + 81, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 85, + 88, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 85, + 92, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "name": "fn", + "optional": false, + "range": Array [ + 94, + 96, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 85, + 96, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 85, + 98, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 85, + 98, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 84, + 100, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 104, + 107, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 108, + 111, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 104, + 111, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 113, + 118, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 104, + 118, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 104, + 118, + ], + "type": "ChainExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "name": "fn", + "optional": false, + "range": Array [ + 120, + 122, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 103, + 122, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "optional": false, + "range": Array [ + 103, + 124, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 103, + 125, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 129, + 132, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 133, + 136, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 129, + 136, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 138, + 143, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 129, + 143, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "name": "fn", + "optional": false, + "range": Array [ + 145, + 147, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 129, + 147, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "optional": false, + "range": Array [ + 129, + 149, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 129, + 149, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 128, + 151, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 8, + }, + "start": Object { + "column": 3, + "line": 8, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 156, + 159, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 3, + "line": 8, + }, + }, + "optional": true, + "range": Array [ + 156, + 163, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 3, + "line": 8, + }, + }, + "range": Array [ + 156, + 163, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 155, + 165, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 169, + 172, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "optional": true, + "range": Array [ + 169, + 176, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "range": Array [ + 169, + 176, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "optional": false, + "range": Array [ + 168, + 179, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 168, + 180, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 10, + }, + "start": Object { + "column": 3, + "line": 10, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 184, + 187, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 10, + }, + "start": Object { + "column": 3, + "line": 10, + }, + }, + "optional": true, + "range": Array [ + 184, + 191, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 10, + }, + "start": Object { + "column": 3, + "line": 10, + }, + }, + "range": Array [ + 184, + 191, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "optional": true, + "range": Array [ + 183, + 196, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 183, + 196, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 183, + 197, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "object": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 12, + }, + "start": Object { + "column": 3, + "line": 12, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 202, + 205, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 12, + }, + "start": Object { + "column": 3, + "line": 12, + }, + }, + "optional": true, + "range": Array [ + 202, + 209, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 12, + }, + "start": Object { + "column": 3, + "line": 12, + }, + }, + "range": Array [ + 202, + 209, + ], + "type": "ChainExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 12, + }, + "start": Object { + "column": 12, + "line": 12, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 211, + 214, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 201, + 214, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "range": Array [ + 201, + 215, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 217, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processOptionalCallParens", + "optional": false, + "range": Array [ + 9, + 34, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "one", + "optional": true, + "range": Array [ + 35, + 44, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 44, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 44, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 217, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 14, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 218, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 34, + ], + "type": "Identifier", + "value": "processOptionalCallParens", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 44, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 51, + 54, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 54, + 56, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 56, + 58, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 66, + 69, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 69, + 71, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 71, + 74, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 76, + 78, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 85, + 88, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 92, + 94, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 94, + 96, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 99, + 100, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 104, + 107, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 108, + 111, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 111, + 113, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 113, + 118, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 118, + 119, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 119, + 120, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 120, + 122, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 21, + "line": 5, + }, + }, + "range": Array [ + 122, + 123, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 123, + 124, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 23, + "line": 5, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 128, + 129, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 129, + 132, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 133, + 136, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 136, + 138, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 138, + 143, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 143, + 145, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "range": Array [ + 145, + 147, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 21, + "line": 6, + }, + }, + "range": Array [ + 147, + 148, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 22, + "line": 6, + }, + }, + "range": Array [ + 148, + 149, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "range": Array [ + 149, + 150, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 24, + "line": 6, + }, + }, + "range": Array [ + 150, + 151, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 155, + 156, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 8, + }, + "start": Object { + "column": 3, + "line": 8, + }, + }, + "range": Array [ + 156, + 159, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 8, + }, + }, + "range": Array [ + 159, + 161, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 161, + 162, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "range": Array [ + 162, + 163, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 8, + }, + }, + "range": Array [ + 163, + 164, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "range": Array [ + 164, + 165, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 168, + 169, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 9, + }, + "start": Object { + "column": 3, + "line": 9, + }, + }, + "range": Array [ + 169, + 172, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 9, + }, + "start": Object { + "column": 6, + "line": 9, + }, + }, + "range": Array [ + 172, + 174, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "range": Array [ + 174, + 175, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 9, + "line": 9, + }, + }, + "range": Array [ + 175, + 176, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "start": Object { + "column": 10, + "line": 9, + }, + }, + "range": Array [ + 176, + 177, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 11, + "line": 9, + }, + }, + "range": Array [ + 177, + 178, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "range": Array [ + 178, + 179, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 9, + }, + "start": Object { + "column": 13, + "line": 9, + }, + }, + "range": Array [ + 179, + 180, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 183, + 184, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 10, + }, + "start": Object { + "column": 3, + "line": 10, + }, + }, + "range": Array [ + 184, + 187, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 10, + }, + "start": Object { + "column": 6, + "line": 10, + }, + }, + "range": Array [ + 187, + 189, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "range": Array [ + 189, + 190, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 10, + }, + "start": Object { + "column": 9, + "line": 10, + }, + }, + "range": Array [ + 190, + 191, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 10, + }, + "start": Object { + "column": 10, + "line": 10, + }, + }, + "range": Array [ + 191, + 192, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 10, + }, + "start": Object { + "column": 11, + "line": 10, + }, + }, + "range": Array [ + 192, + 194, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 10, + }, + "start": Object { + "column": 13, + "line": 10, + }, + }, + "range": Array [ + 194, + 195, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 10, + }, + "start": Object { + "column": 14, + "line": 10, + }, + }, + "range": Array [ + 195, + 196, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 10, + }, + "start": Object { + "column": 15, + "line": 10, + }, + }, + "range": Array [ + 196, + 197, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "range": Array [ + 201, + 202, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 12, + }, + "start": Object { + "column": 3, + "line": 12, + }, + }, + "range": Array [ + 202, + 205, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 12, + }, + "start": Object { + "column": 6, + "line": 12, + }, + }, + "range": Array [ + 205, + 207, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 12, + }, + "start": Object { + "column": 8, + "line": 12, + }, + }, + "range": Array [ + 207, + 208, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 12, + }, + "start": Object { + "column": 9, + "line": 12, + }, + }, + "range": Array [ + 208, + 209, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 12, + }, + "start": Object { + "column": 10, + "line": 12, + }, + }, + "range": Array [ + 209, + 210, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 12, + }, + "start": Object { + "column": 11, + "line": 12, + }, + }, + "range": Array [ + 210, + 211, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 12, + }, + "start": Object { + "column": 12, + "line": 12, + }, + }, + "range": Array [ + 211, + 214, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 12, + }, + "start": Object { + "column": 15, + "line": 12, + }, + }, + "range": Array [ + 214, + 215, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 13, + }, + }, + "range": Array [ + 216, + 217, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-call.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-call.src.ts.shot new file mode 100644 index 00000000000..64eafcb5be3 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-call.src.ts.shot @@ -0,0 +1,2772 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics optional-chain-call.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 44, + 47, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "name": "fn", + "optional": false, + "range": Array [ + 49, + 51, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 44, + 51, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 44, + 53, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 44, + 53, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 44, + 54, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 57, + 60, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 62, + 65, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 57, + 65, + ], + "type": "MemberExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "name": "fn", + "optional": false, + "range": Array [ + 66, + 68, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 57, + 68, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "range": Array [ + 57, + 70, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 57, + 70, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 57, + 71, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 74, + 77, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 78, + 81, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 74, + 81, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "name": "fn", + "optional": false, + "range": Array [ + 83, + 85, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 74, + 85, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 74, + 87, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 74, + 87, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 74, + 88, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 91, + 94, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 95, + 98, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 91, + 98, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 100, + 105, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 91, + 105, + ], + "type": "MemberExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "name": "fn", + "optional": false, + "range": Array [ + 106, + 108, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 91, + 108, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "optional": false, + "range": Array [ + 91, + 110, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 91, + 110, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 91, + 111, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 114, + 117, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 118, + 121, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 114, + 121, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 123, + 128, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 114, + 128, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "name": "fn", + "optional": false, + "range": Array [ + 130, + 132, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 114, + 132, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "optional": false, + "range": Array [ + 114, + 134, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 114, + 134, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 114, + 135, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 139, + 142, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "optional": true, + "range": Array [ + 139, + 146, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 139, + 146, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 139, + 147, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 150, + 153, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "optional": true, + "range": Array [ + 150, + 157, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "optional": false, + "range": Array [ + 150, + 159, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 150, + 159, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 150, + 160, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 163, + 166, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "optional": true, + "range": Array [ + 163, + 170, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "optional": true, + "range": Array [ + 163, + 174, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 163, + 174, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 163, + 175, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 13, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "object": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 179, + 182, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "optional": true, + "range": Array [ + 179, + 186, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 12, + }, + "start": Object { + "column": 10, + "line": 12, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 187, + 190, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 179, + 190, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "range": Array [ + 179, + 190, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "range": Array [ + 179, + 191, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 193, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processOptionalCall", + "optional": false, + "range": Array [ + 9, + 28, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "one", + "optional": true, + "range": Array [ + 29, + 38, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 193, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 14, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 194, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 28, + ], + "type": "Identifier", + "value": "processOptionalCall", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 44, + 47, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 47, + 49, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 49, + 51, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 57, + 60, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 60, + 62, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 62, + 65, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 66, + 68, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 74, + 77, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 78, + 81, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 81, + 83, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 83, + 85, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 87, + 88, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 91, + 94, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 95, + 98, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 98, + 100, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 100, + 105, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 106, + 108, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 21, + "line": 5, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 114, + 117, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 118, + 121, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 121, + 123, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 123, + 128, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 128, + 130, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 130, + 132, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 20, + "line": 6, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 21, + "line": 6, + }, + }, + "range": Array [ + 133, + 134, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 22, + "line": 6, + }, + }, + "range": Array [ + 134, + 135, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 139, + 142, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 8, + }, + "start": Object { + "column": 5, + "line": 8, + }, + }, + "range": Array [ + 142, + 144, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 7, + "line": 8, + }, + }, + "range": Array [ + 144, + 145, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 145, + 146, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "range": Array [ + 146, + 147, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 9, + }, + "start": Object { + "column": 2, + "line": 9, + }, + }, + "range": Array [ + 150, + 153, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 9, + }, + "start": Object { + "column": 5, + "line": 9, + }, + }, + "range": Array [ + 153, + 155, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 9, + }, + "start": Object { + "column": 7, + "line": 9, + }, + }, + "range": Array [ + 155, + 156, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 9, + }, + "start": Object { + "column": 8, + "line": 9, + }, + }, + "range": Array [ + 156, + 157, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 9, + "line": 9, + }, + }, + "range": Array [ + 157, + 158, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 9, + }, + "start": Object { + "column": 10, + "line": 9, + }, + }, + "range": Array [ + 158, + 159, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 9, + }, + "start": Object { + "column": 11, + "line": 9, + }, + }, + "range": Array [ + 159, + 160, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 163, + 166, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 10, + }, + "start": Object { + "column": 5, + "line": 10, + }, + }, + "range": Array [ + 166, + 168, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 10, + }, + "start": Object { + "column": 7, + "line": 10, + }, + }, + "range": Array [ + 168, + 169, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "range": Array [ + 169, + 170, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 10, + }, + "start": Object { + "column": 9, + "line": 10, + }, + }, + "range": Array [ + 170, + 172, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 10, + }, + "start": Object { + "column": 11, + "line": 10, + }, + }, + "range": Array [ + 172, + 173, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 10, + }, + "start": Object { + "column": 12, + "line": 10, + }, + }, + "range": Array [ + 173, + 174, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 10, + }, + "start": Object { + "column": 13, + "line": 10, + }, + }, + "range": Array [ + 174, + 175, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "range": Array [ + 179, + 182, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 12, + }, + "start": Object { + "column": 5, + "line": 12, + }, + }, + "range": Array [ + 182, + 184, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 12, + }, + "start": Object { + "column": 7, + "line": 12, + }, + }, + "range": Array [ + 184, + 185, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 12, + }, + "start": Object { + "column": 8, + "line": 12, + }, + }, + "range": Array [ + 185, + 186, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 12, + }, + "start": Object { + "column": 9, + "line": 12, + }, + }, + "range": Array [ + 186, + 187, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 12, + }, + "start": Object { + "column": 10, + "line": 12, + }, + }, + "range": Array [ + 187, + 190, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 12, + }, + "start": Object { + "column": 13, + "line": 12, + }, + }, + "range": Array [ + 190, + 191, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 13, + }, + "start": Object { + "column": 0, + "line": 13, + }, + }, + "range": Array [ + 192, + 193, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-element-access-with-non-null-assertion.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-element-access-with-non-null-assertion.src.ts.shot new file mode 100644 index 00000000000..4cb40072283 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-element-access-with-non-null-assertion.src.ts.shot @@ -0,0 +1,2294 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics optional-chain-element-access-with-non-null-assertion.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "object": Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 46, + 51, + ], + "raw": "'two'", + "type": "Literal", + "value": "two", + }, + "range": Array [ + 40, + 52, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 40, + 53, + ], + "type": "TSNonNullExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 54, + 59, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 40, + 59, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 40, + 59, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 40, + 60, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "expression": Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 64, + 67, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 70, + 75, + ], + "raw": "'two'", + "type": "Literal", + "value": "two", + }, + "range": Array [ + 64, + 76, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 64, + 76, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 63, + 78, + ], + "type": "TSNonNullExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 79, + 84, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 63, + 84, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 63, + 85, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "expression": Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 95, + 100, + ], + "raw": "'two'", + "type": "Literal", + "value": "two", + }, + "range": Array [ + 89, + 101, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 89, + 102, + ], + "type": "TSNonNullExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 89, + 102, + ], + "type": "ChainExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 104, + 109, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 88, + 109, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 88, + 110, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 113, + 116, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 118, + 121, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 113, + 121, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 113, + 122, + ], + "type": "TSNonNullExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 123, + 130, + ], + "raw": "'three'", + "type": "Literal", + "value": "three", + }, + "range": Array [ + 113, + 131, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 113, + 131, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 113, + 132, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 136, + 139, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 141, + 144, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 136, + 144, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 136, + 144, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 135, + 146, + ], + "type": "TSNonNullExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 147, + 154, + ], + "raw": "'three'", + "type": "Literal", + "value": "three", + }, + "range": Array [ + 135, + 155, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 135, + 156, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 22, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "object": Object { + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 160, + 163, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 165, + 168, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 160, + 168, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "range": Array [ + 160, + 169, + ], + "type": "TSNonNullExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "range": Array [ + 160, + 169, + ], + "type": "ChainExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 171, + 178, + ], + "raw": "'three'", + "type": "Literal", + "value": "three", + }, + "range": Array [ + 159, + 179, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 159, + 180, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 182, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processOptional", + "optional": false, + "range": Array [ + 9, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "one", + "optional": true, + "range": Array [ + 25, + 34, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 34, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 182, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 183, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 24, + ], + "type": "Identifier", + "value": "processOptional", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 43, + 45, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 46, + 51, + ], + "type": "String", + "value": "'two'", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 54, + 59, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 64, + 67, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 67, + 69, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 70, + 75, + ], + "type": "String", + "value": "'two'", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 79, + 84, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 92, + 94, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 95, + 100, + ], + "type": "String", + "value": "'two'", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 101, + 102, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 104, + 109, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 113, + 116, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 116, + 118, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 118, + 121, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 121, + 122, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 122, + 123, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 123, + 130, + ], + "type": "String", + "value": "'three'", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 135, + 136, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 136, + 139, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 139, + 141, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 141, + 144, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 144, + 145, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 145, + 146, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 146, + 147, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 147, + 154, + ], + "type": "String", + "value": "'three'", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 21, + "line": 6, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 22, + "line": 6, + }, + }, + "range": Array [ + 155, + 156, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 159, + 160, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "range": Array [ + 160, + 163, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 163, + 165, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 165, + 168, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 168, + 169, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 169, + 170, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 170, + 171, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 171, + 178, + ], + "type": "String", + "value": "'three'", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 7, + }, + "start": Object { + "column": 21, + "line": 7, + }, + }, + "range": Array [ + 178, + 179, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 22, + "line": 7, + }, + }, + "range": Array [ + 179, + 180, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 181, + 182, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-element-access-with-parens.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-element-access-with-parens.src.ts.shot new file mode 100644 index 00000000000..b9bcd42e586 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-element-access-with-parens.src.ts.shot @@ -0,0 +1,2618 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics optional-chain-element-access-with-parens.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 54, + 57, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 60, + 61, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 54, + 62, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 54, + 62, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 53, + 64, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 68, + 71, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 74, + 75, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 68, + 76, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 68, + 76, + ], + "type": "ChainExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 78, + 79, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 67, + 80, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 67, + 81, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 85, + 88, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 89, + 90, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 85, + 91, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 94, + 95, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 85, + 96, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 85, + 96, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 84, + 98, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 102, + 105, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 106, + 107, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 102, + 108, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 111, + 112, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 102, + 113, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 102, + 113, + ], + "type": "ChainExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 115, + 116, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "range": Array [ + 101, + 117, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 101, + 118, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 126, + 127, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 122, + 128, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 131, + 132, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 122, + 133, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 136, + 137, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "range": Array [ + 122, + 138, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 122, + 138, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 121, + 140, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "object": Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 144, + 147, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 148, + 149, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 144, + 150, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 153, + 154, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 144, + 155, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 158, + 159, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "range": Array [ + 144, + 160, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "range": Array [ + 144, + 160, + ], + "type": "ChainExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 7, + }, + "start": Object { + "column": 21, + "line": 7, + }, + }, + "range": Array [ + 162, + 163, + ], + "raw": "5", + "type": "Literal", + "value": 5, + }, + "range": Array [ + 143, + 164, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 143, + 165, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 167, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processOptionalElementParens", + "optional": false, + "range": Array [ + 9, + 37, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "name": "one", + "optional": true, + "range": Array [ + 38, + 47, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 47, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 47, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 167, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 168, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 37, + ], + "type": "Identifier", + "value": "processOptionalElementParens", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 41, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 47, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 54, + 57, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 57, + 59, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 68, + 71, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 71, + 73, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 85, + 88, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 91, + 93, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 101, + 102, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 102, + 105, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 108, + 110, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 121, + 122, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 125, + 126, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 126, + 127, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 127, + 128, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 128, + 130, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 133, + 135, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 135, + 136, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 137, + 138, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "range": Array [ + 138, + 139, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 20, + "line": 6, + }, + }, + "range": Array [ + 139, + 140, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 143, + 144, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "range": Array [ + 144, + 147, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 147, + 148, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 148, + 149, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 149, + 150, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "range": Array [ + 150, + 152, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 152, + 153, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 153, + 154, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 155, + 157, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 7, + }, + }, + "range": Array [ + 157, + 158, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 158, + 159, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 18, + "line": 7, + }, + }, + "range": Array [ + 159, + 160, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 7, + }, + "start": Object { + "column": 19, + "line": 7, + }, + }, + "range": Array [ + 160, + 161, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 161, + 162, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 7, + }, + "start": Object { + "column": 21, + "line": 7, + }, + }, + "range": Array [ + 162, + 163, + ], + "type": "Numeric", + "value": "5", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 22, + "line": 7, + }, + }, + "range": Array [ + 163, + 164, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 7, + }, + "start": Object { + "column": 23, + "line": 7, + }, + }, + "range": Array [ + 164, + 165, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 166, + 167, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-element-access.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-element-access.src.ts.shot new file mode 100644 index 00000000000..65a342a69b0 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-element-access.src.ts.shot @@ -0,0 +1,2200 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics optional-chain-element-access.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 47, + 55, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 47, + 55, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 47, + 56, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 59, + 62, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 65, + 66, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 59, + 67, + ], + "type": "MemberExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 68, + 69, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 59, + 70, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 59, + 70, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 59, + 71, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 74, + 77, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 78, + 79, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 74, + 80, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 74, + 85, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 74, + 85, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 74, + 86, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 93, + 94, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 89, + 95, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 98, + 99, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 89, + 100, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 89, + 100, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 89, + 101, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 104, + 107, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 108, + 109, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 104, + 110, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 113, + 114, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 104, + 115, + ], + "type": "MemberExpression", + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 116, + 117, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "range": Array [ + 104, + 118, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 104, + 118, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 104, + 119, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "object": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 126, + 127, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "range": Array [ + 122, + 128, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 131, + 132, + ], + "raw": "3", + "type": "Literal", + "value": 3, + }, + "range": Array [ + 122, + 133, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 7, + }, + }, + "range": Array [ + 136, + 137, + ], + "raw": "4", + "type": "Literal", + "value": 4, + }, + "range": Array [ + 122, + 138, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 122, + 138, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 122, + 139, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 141, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processOptionalElement", + "optional": false, + "range": Array [ + 9, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "name": "one", + "optional": true, + "range": Array [ + 32, + 41, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 41, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 41, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 141, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 142, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 31, + ], + "type": "Identifier", + "value": "processOptionalElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 41, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 50, + 52, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 59, + 62, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 62, + 64, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 74, + 77, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 80, + 82, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 89, + 92, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 95, + 97, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 99, + 100, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 104, + 107, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 110, + 112, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 113, + 114, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 15, + "line": 6, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 118, + 119, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 122, + 125, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "range": Array [ + 125, + 126, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 126, + 127, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 127, + 128, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 128, + 130, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Numeric", + "value": "3", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 133, + 135, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 7, + }, + }, + "range": Array [ + 135, + 136, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 16, + "line": 7, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Numeric", + "value": "4", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 137, + 138, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 18, + "line": 7, + }, + }, + "range": Array [ + 138, + 139, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 140, + 141, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-with-non-null-assertion.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-with-non-null-assertion.src.ts.shot new file mode 100644 index 00000000000..8d488e0d54e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-with-non-null-assertion.src.ts.shot @@ -0,0 +1,1235 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics optional-chain-with-non-null-assertion.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "object": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 45, + 48, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 40, + 48, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 40, + 49, + ], + "type": "TSNonNullExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 50, + 55, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 40, + 55, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 40, + 55, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 40, + 56, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 60, + 63, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 65, + 68, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 60, + 68, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 60, + 68, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 59, + 70, + ], + "type": "TSNonNullExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 71, + 76, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 59, + 76, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 59, + 77, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 81, + 84, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 86, + 89, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 81, + 89, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 81, + 90, + ], + "type": "TSNonNullExpression", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 81, + 90, + ], + "type": "ChainExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 92, + 97, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 80, + 97, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 80, + 98, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 100, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processOptional", + "optional": false, + "range": Array [ + 9, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "one", + "optional": true, + "range": Array [ + 25, + 34, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 34, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 100, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 101, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 24, + ], + "type": "Identifier", + "value": "processOptional", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 43, + 45, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 45, + 48, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 50, + 55, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 60, + 63, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 63, + 65, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 65, + 68, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 71, + 76, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 81, + 84, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 84, + 86, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 86, + 89, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 91, + 92, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 14, + "line": 4, + }, + }, + "range": Array [ + 92, + 97, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 99, + 100, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-with-parens.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-with-parens.src.ts.shot new file mode 100644 index 00000000000..abb458ba8fb --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain-with-parens.src.ts.shot @@ -0,0 +1,2234 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics optional-chain-with-parens.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 47, + 55, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 47, + 55, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 46, + 57, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 61, + 64, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 66, + 69, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 61, + 69, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 61, + 69, + ], + "type": "ChainExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 71, + 76, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 60, + 76, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 60, + 77, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 81, + 84, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 85, + 88, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 81, + 88, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 90, + 95, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 81, + 95, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 81, + 95, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 80, + 97, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 101, + 104, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 105, + 108, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 101, + 108, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 110, + 115, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 101, + 115, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 101, + 115, + ], + "type": "ChainExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "name": "four", + "optional": false, + "range": Array [ + 117, + 121, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 100, + 121, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 100, + 122, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 126, + 129, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 130, + 133, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 126, + 133, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 135, + 140, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 126, + 140, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "name": "four", + "optional": false, + "range": Array [ + 142, + 146, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 126, + 146, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 126, + 146, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 125, + 148, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 29, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "object": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 152, + 155, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 156, + 159, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 152, + 159, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 161, + 166, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 152, + 166, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 19, + "line": 7, + }, + }, + "name": "four", + "optional": false, + "range": Array [ + 168, + 172, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 152, + 172, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "range": Array [ + 152, + 172, + ], + "type": "ChainExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 7, + }, + "start": Object { + "column": 25, + "line": 7, + }, + }, + "name": "five", + "optional": false, + "range": Array [ + 174, + 178, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 151, + 178, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 151, + 179, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 181, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processOptionalParens", + "optional": false, + "range": Array [ + 9, + 30, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "name": "one", + "optional": true, + "range": Array [ + 31, + 40, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 40, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 40, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 181, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 182, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 30, + ], + "type": "Identifier", + "value": "processOptionalParens", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 40, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 47, + 50, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 50, + 52, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 61, + 64, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 64, + 66, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 66, + 69, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 71, + 76, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 81, + 84, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 85, + 88, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 88, + 90, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 90, + 95, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 101, + 104, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 104, + 105, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 105, + 108, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 108, + 110, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 110, + 115, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 18, + "line": 5, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 117, + 121, + ], + "type": "Identifier", + "value": "four", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 23, + "line": 5, + }, + }, + "range": Array [ + 121, + 122, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 125, + 126, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 3, + "line": 6, + }, + }, + "range": Array [ + 126, + 129, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 129, + 130, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 130, + 133, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 133, + 135, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 135, + 140, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 17, + "line": 6, + }, + }, + "range": Array [ + 140, + 142, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 19, + "line": 6, + }, + }, + "range": Array [ + 142, + 146, + ], + "type": "Identifier", + "value": "four", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 6, + }, + }, + "range": Array [ + 146, + 147, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 6, + }, + "start": Object { + "column": 24, + "line": 6, + }, + }, + "range": Array [ + 147, + 148, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 151, + 152, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 3, + "line": 7, + }, + }, + "range": Array [ + 152, + 155, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 155, + 156, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 156, + 159, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 159, + 161, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 161, + 166, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 17, + "line": 7, + }, + }, + "range": Array [ + 166, + 168, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 7, + }, + "start": Object { + "column": 19, + "line": 7, + }, + }, + "range": Array [ + 168, + 172, + ], + "type": "Identifier", + "value": "four", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 7, + }, + "start": Object { + "column": 23, + "line": 7, + }, + }, + "range": Array [ + 172, + 173, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 7, + }, + "start": Object { + "column": 24, + "line": 7, + }, + }, + "range": Array [ + 173, + 174, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 7, + }, + "start": Object { + "column": 25, + "line": 7, + }, + }, + "range": Array [ + 174, + 178, + ], + "type": "Identifier", + "value": "five", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 7, + }, + "start": Object { + "column": 29, + "line": 7, + }, + }, + "range": Array [ + 178, + 179, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 180, + 181, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain.src.ts.shot new file mode 100644 index 00000000000..d6a2c2b96e8 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/optional-chain.src.ts.shot @@ -0,0 +1,1622 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics optional-chain.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 45, + 48, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 40, + 48, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 40, + 48, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 40, + 49, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 57, + 60, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 52, + 60, + ], + "type": "MemberExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 61, + 66, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 52, + 66, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 52, + 66, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 52, + 67, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 70, + 73, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 74, + 77, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 70, + 77, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 79, + 84, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 70, + 84, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 70, + 84, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 70, + 85, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 88, + 91, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 92, + 95, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 88, + 95, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 97, + 102, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 88, + 102, + ], + "type": "MemberExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "name": "four", + "optional": false, + "range": Array [ + 103, + 107, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 88, + 107, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 88, + 107, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 88, + 108, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "name": "one", + "optional": false, + "range": Array [ + 111, + 114, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "name": "two", + "optional": false, + "range": Array [ + 115, + 118, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 111, + 118, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "name": "three", + "optional": false, + "range": Array [ + 120, + 125, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 111, + 125, + ], + "type": "MemberExpression", + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "name": "four", + "optional": false, + "range": Array [ + 127, + 131, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 111, + 131, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 111, + 131, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 111, + 132, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 134, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "processOptional", + "optional": false, + "range": Array [ + 9, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "one", + "optional": true, + "range": Array [ + 25, + 34, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 34, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 134, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 135, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 24, + ], + "type": "Identifier", + "value": "processOptional", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 40, + 43, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 43, + 45, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 45, + 48, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 52, + 55, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 55, + 57, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 57, + 60, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 61, + 66, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 70, + 73, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 74, + 77, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 77, + 79, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 79, + 84, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 88, + 91, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 91, + 92, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 92, + 95, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 95, + 97, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 97, + 102, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 103, + 107, + ], + "type": "Identifier", + "value": "four", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 21, + "line": 5, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 111, + 114, + ], + "type": "Identifier", + "value": "one", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 115, + 118, + ], + "type": "Identifier", + "value": "two", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 118, + 120, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 120, + 125, + ], + "type": "Identifier", + "value": "three", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 125, + 127, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 127, + 131, + ], + "type": "Identifier", + "value": "four", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 6, + }, + "start": Object { + "column": 22, + "line": 6, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 133, + 134, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/parenthesized-use-strict.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/parenthesized-use-strict.src.ts.shot new file mode 100644 index 00000000000..9f49ca46bda --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/parenthesized-use-strict.src.ts.shot @@ -0,0 +1,155 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics parenthesized-use-strict.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 46, + 58, + ], + "raw": "\\"use strict\\"", + "type": "Literal", + "value": "use strict", + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 45, + 60, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "type": "Line", + "value": " this should not be classed as a directive", + }, + ], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 45, + 60, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 46, + 58, + ], + "type": "String", + "value": "\\"use strict\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/private-fields-in-in.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/private-fields-in-in.src.ts.shot new file mode 100644 index 00000000000..384a9c4db14 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/private-fields-in-in.src.ts.shot @@ -0,0 +1,629 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics private-fields-in-in.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "prop1", + "range": Array [ + 14, + 20, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 21, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": null, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "method", + "optional": false, + "range": Array [ + 24, + 30, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 24, + 67, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "name": "prop1", + "range": Array [ + 49, + 55, + ], + "type": "PrivateIdentifier", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "operator": "in", + "range": Array [ + 49, + 62, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "name": "arg", + "optional": false, + "range": Array [ + 59, + 62, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 42, + 63, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 36, + 67, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "arg", + "optional": false, + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 30, + 67, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 69, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 69, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 70, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + "value": "#prop1", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 24, + 30, + ], + "type": "Identifier", + "value": "method", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + "value": "arg", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 49, + 55, + ], + "type": "Identifier", + "value": "#prop1", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 56, + 58, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 21, + "line": 4, + }, + }, + "range": Array [ + 59, + 62, + ], + "type": "Identifier", + "value": "arg", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/readonly-arrays.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/readonly-arrays.src.ts.shot new file mode 100644 index 00000000000..b7b7d0a21c1 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/readonly-arrays.src.ts.shot @@ -0,0 +1,1766 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics readonly-arrays.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "arr", + "optional": false, + "range": Array [ + 45, + 48, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "slice", + "optional": false, + "range": Array [ + 49, + 54, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 45, + 54, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 45, + 56, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 45, + 57, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 84, + 92, + ], + "raw": "\\"hello!\\"", + "type": "Literal", + "value": "hello!", + }, + ], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "arr", + "optional": false, + "range": Array [ + 75, + 78, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "push", + "optional": false, + "range": Array [ + 79, + 83, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 75, + 83, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "range": Array [ + 75, + 93, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 75, + 94, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 106, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "arr", + "optional": false, + "range": Array [ + 13, + 39, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 39, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 39, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "ReadonlyArray", + "optional": false, + "range": Array [ + 18, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSStringKeyword", + }, + ], + "range": Array [ + 31, + 39, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + }, + ], + "range": Array [ + 0, + 106, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "name": "arr", + "optional": false, + "range": Array [ + 149, + 152, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "name": "slice", + "optional": false, + "range": Array [ + 153, + 158, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 149, + 158, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "optional": false, + "range": Array [ + 149, + 160, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 149, + 161, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "range": Array [ + 188, + 196, + ], + "raw": "\\"hello!\\"", + "type": "Literal", + "value": "hello!", + }, + ], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "name": "arr", + "optional": false, + "range": Array [ + 179, + 182, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 8, + }, + }, + "name": "push", + "optional": false, + "range": Array [ + 183, + 187, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 179, + 187, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "optional": false, + "range": Array [ + 179, + 197, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 179, + 198, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 37, + "line": 6, + }, + }, + "range": Array [ + 145, + 210, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 117, + 120, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "name": "arr", + "optional": false, + "range": Array [ + 121, + 143, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 124, + 143, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "operator": "readonly", + "range": Array [ + 126, + 143, + ], + "type": "TSTypeOperator", + "typeAnnotation": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 6, + }, + "start": Object { + "column": 27, + "line": 6, + }, + }, + "range": Array [ + 135, + 141, + ], + "type": "TSStringKeyword", + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 6, + }, + "start": Object { + "column": 27, + "line": 6, + }, + }, + "range": Array [ + 135, + 143, + ], + "type": "TSArrayType", + }, + }, + }, + }, + ], + "range": Array [ + 108, + 210, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 65, + 72, + ], + "type": "Line", + "value": " okay", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 95, + 104, + ], + "type": "Line", + "value": " error!", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 7, + }, + "start": Object { + "column": 22, + "line": 7, + }, + }, + "range": Array [ + 169, + 176, + ], + "type": "Line", + "value": " okay", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 8, + }, + "start": Object { + "column": 22, + "line": 8, + }, + }, + "range": Array [ + 199, + 208, + ], + "type": "Line", + "value": " error!", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 211, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "arr", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 31, + ], + "type": "Identifier", + "value": "ReadonlyArray", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 45, + 48, + ], + "type": "Identifier", + "value": "arr", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 49, + 54, + ], + "type": "Identifier", + "value": "slice", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 75, + 78, + ], + "type": "Identifier", + "value": "arr", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 79, + 83, + ], + "type": "Identifier", + "value": "push", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 84, + 92, + ], + "type": "String", + "value": "\\"hello!\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 93, + 94, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 108, + 116, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 117, + 120, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 120, + 121, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 121, + 124, + ], + "type": "Identifier", + "value": "arr", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 126, + 134, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 6, + }, + "start": Object { + "column": 27, + "line": 6, + }, + }, + "range": Array [ + 135, + 141, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 6, + }, + "start": Object { + "column": 33, + "line": 6, + }, + }, + "range": Array [ + 141, + 142, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 6, + }, + "start": Object { + "column": 34, + "line": 6, + }, + }, + "range": Array [ + 142, + 143, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 6, + }, + "start": Object { + "column": 35, + "line": 6, + }, + }, + "range": Array [ + 143, + 144, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 6, + }, + "start": Object { + "column": 37, + "line": 6, + }, + }, + "range": Array [ + 145, + 146, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 149, + 152, + ], + "type": "Identifier", + "value": "arr", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "range": Array [ + 152, + 153, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 153, + 158, + ], + "type": "Identifier", + "value": "slice", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 158, + 159, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 159, + 160, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 160, + 161, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 179, + 182, + ], + "type": "Identifier", + "value": "arr", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 8, + }, + "start": Object { + "column": 5, + "line": 8, + }, + }, + "range": Array [ + 182, + 183, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 8, + }, + "start": Object { + "column": 6, + "line": 8, + }, + }, + "range": Array [ + 183, + 187, + ], + "type": "Identifier", + "value": "push", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 8, + }, + }, + "range": Array [ + 187, + 188, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 8, + }, + "start": Object { + "column": 11, + "line": 8, + }, + }, + "range": Array [ + 188, + 196, + ], + "type": "String", + "value": "\\"hello!\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 8, + }, + "start": Object { + "column": 19, + "line": 8, + }, + }, + "range": Array [ + 196, + 197, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 8, + }, + "start": Object { + "column": 20, + "line": 8, + }, + }, + "range": Array [ + 197, + 198, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 209, + 210, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/readonly-tuples.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/readonly-tuples.src.ts.shot new file mode 100644 index 00000000000..789b6940c55 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/readonly-tuples.src.ts.shot @@ -0,0 +1,1068 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics readonly-tuples.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [ + Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "pair", + "optional": false, + "range": Array [ + 62, + 66, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 67, + 68, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "range": Array [ + 62, + 69, + ], + "type": "MemberExpression", + }, + ], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "console", + "optional": false, + "range": Array [ + 50, + 57, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "log", + "optional": false, + "range": Array [ + 58, + 61, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 50, + 61, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 50, + 70, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 50, + 71, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "computed": true, + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "pair", + "optional": false, + "range": Array [ + 84, + 88, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 89, + 90, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "range": Array [ + 84, + 91, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "operator": "=", + "range": Array [ + 84, + 102, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 94, + 102, + ], + "raw": "\\"hello!\\"", + "type": "Literal", + "value": "hello!", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 84, + 103, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 118, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "pair", + "optional": false, + "range": Array [ + 13, + 44, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 44, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "operator": "readonly", + "range": Array [ + 19, + 44, + ], + "type": "TSTypeOperator", + "typeAnnotation": Object { + "elementTypes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 43, + ], + "type": "TSStringKeyword", + }, + ], + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 44, + ], + "type": "TSTupleType", + }, + }, + }, + }, + ], + "range": Array [ + 0, + 118, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 74, + 81, + ], + "type": "Line", + "value": " okay", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 108, + 116, + ], + "type": "Line", + "value": " error", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 119, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 17, + ], + "type": "Identifier", + "value": "pair", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 27, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 43, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 50, + 57, + ], + "type": "Identifier", + "value": "console", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 58, + 61, + ], + "type": "Identifier", + "value": "log", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 62, + 66, + ], + "type": "Identifier", + "value": "pair", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 84, + 88, + ], + "type": "Identifier", + "value": "pair", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 94, + 102, + ], + "type": "String", + "value": "\\"hello!\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 102, + 103, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/short-circuiting-assignment-and-and.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/short-circuiting-assignment-and-and.src.ts.shot new file mode 100644 index 00000000000..6783484bf3e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/short-circuiting-assignment-and-and.src.ts.shot @@ -0,0 +1,177 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics short-circuiting-assignment-and-and.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "||=", + "range": Array [ + 0, + 7, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 5, + ], + "type": "Punctuator", + "value": "||=", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/short-circuiting-assignment-or-or.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/short-circuiting-assignment-or-or.src.ts.shot new file mode 100644 index 00000000000..5dabb523118 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/short-circuiting-assignment-or-or.src.ts.shot @@ -0,0 +1,177 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics short-circuiting-assignment-or-or.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "&&=", + "range": Array [ + 0, + 7, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 5, + ], + "type": "Punctuator", + "value": "&&=", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/short-circuiting-assignment-question-question.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/short-circuiting-assignment-question-question.src.ts.shot new file mode 100644 index 00000000000..d00f83597a6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/short-circuiting-assignment-question-question.src.ts.shot @@ -0,0 +1,177 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics short-circuiting-assignment-question-question.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "operator": "??=", + "range": Array [ + 0, + 7, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 5, + ], + "type": "Punctuator", + "value": "??=", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/symbol-type-param.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/symbol-type-param.src.ts.shot new file mode 100644 index 00000000000..60577d28b4a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/symbol-type-param.src.ts.shot @@ -0,0 +1,471 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics symbol-type-param.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 42, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "test", + "optional": false, + "range": Array [ + 9, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "abc", + "optional": false, + "range": Array [ + 14, + 38, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 38, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "Map", + "optional": false, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "TSSymbolKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TSStringKeyword", + }, + ], + "range": Array [ + 22, + 38, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + }, + ], + "range": Array [ + 0, + 42, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "abc", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "Map", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "Identifier", + "value": "symbol", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-export-function-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-export-function-type.src.ts.shot new file mode 100644 index 00000000000..244d0052276 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-export-function-type.src.ts.shot @@ -0,0 +1,412 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-alias-declaration-export-function-type.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "TestCallback", + "optional": false, + "range": Array [ + 12, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 47, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 28, + 37, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 37, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 27, + 46, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 46, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 46, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSFunctionType", + "typeParameters": undefined, + }, + "typeParameters": undefined, + }, + "exportKind": "type", + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 24, + ], + "type": "Identifier", + "value": "TestCallback", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 41, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 46, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-export-object-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-export-object-type.src.ts.shot new file mode 100644 index 00000000000..bce20128d3f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-export-object-type.src.ts.shot @@ -0,0 +1,366 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-alias-declaration-export-object-type.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "TestClassProps", + "optional": false, + "range": Array [ + 12, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 51, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "members": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "count", + "optional": false, + "range": Array [ + 35, + 40, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 35, + 48, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 40, + 48, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 29, + 50, + ], + "type": "TSTypeLiteral", + }, + "typeParameters": undefined, + }, + "exportKind": "type", + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 26, + ], + "type": "Identifier", + "value": "TestClassProps", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 35, + 40, + ], + "type": "Identifier", + "value": "count", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-export.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-export.src.ts.shot new file mode 100644 index 00000000000..f6aa2333339 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-export.src.ts.shot @@ -0,0 +1,285 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-alias-declaration-export.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "TestAlias", + "optional": false, + "range": Array [ + 12, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 40, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 39, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 30, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 39, + ], + "type": "TSNumberKeyword", + }, + ], + }, + "typeParameters": undefined, + }, + "exportKind": "type", + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 11, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 21, + ], + "type": "Identifier", + "value": "TestAlias", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 30, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 39, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-with-constrained-type-parameter.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-with-constrained-type-parameter.src.ts.shot new file mode 100644 index 00000000000..b5e6bcb8d2a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-with-constrained-type-parameter.src.ts.shot @@ -0,0 +1,568 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-alias-declaration-with-constrained-type-parameter.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Result", + "optional": false, + "range": Array [ + 5, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 48, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 38, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "Success", + "optional": false, + "range": Array [ + 28, + 35, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 35, + 38, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 48, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "name": "Failure", + "optional": false, + "range": Array [ + 41, + 48, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "members": Array [], + "range": Array [ + 22, + 24, + ], + "type": "TSTypeLiteral", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 12, + 24, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 11, + 25, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "type": "Identifier", + "value": "Result", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 35, + ], + "type": "Identifier", + "value": "Success", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 48, + ], + "type": "Identifier", + "value": "Failure", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration.src.ts.shot new file mode 100644 index 00000000000..d3804f1e937 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration.src.ts.shot @@ -0,0 +1,497 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-alias-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Result", + "optional": false, + "range": Array [ + 5, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 37, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 27, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "Success", + "optional": false, + "range": Array [ + 17, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 24, + 27, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 37, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "Failure", + "optional": false, + "range": Array [ + 30, + 37, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 12, + 13, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 11, + 14, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "type": "Identifier", + "value": "Result", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 24, + ], + "type": "Identifier", + "value": "Success", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 37, + ], + "type": "Identifier", + "value": "Failure", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-object-without-annotation.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-object-without-annotation.src.ts.shot new file mode 100644 index 00000000000..545a5e2b59f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-object-without-annotation.src.ts.shot @@ -0,0 +1,409 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-alias-object-without-annotation.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "members": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 12, + 24, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 23, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 23, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 25, + 28, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 11, + 29, + ], + "type": "TSTypeLiteral", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 23, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-arrow-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-arrow-function.src.ts.shot new file mode 100644 index 00000000000..61082763c66 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-arrow-function.src.ts.shot @@ -0,0 +1,529 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-assertion-in-arrow-function.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "assertString", + "optional": false, + "range": Array [ + 6, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 50, + 56, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 58, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 21, + 58, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 40, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": true, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "parameterName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 31, + 40, + ], + "type": "TSTypePredicate", + "typeAnnotation": null, + }, + }, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 58, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 58, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 59, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 18, + ], + "type": "Identifier", + "value": "assertString", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "Identifier", + "value": "asserts", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 43, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 50, + 56, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-function.src.ts.shot new file mode 100644 index 00000000000..a9cebd20e86 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-function.src.ts.shot @@ -0,0 +1,454 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-assertion-in-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 48, + 54, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 56, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "assertsString", + "optional": false, + "range": Array [ + 9, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 23, + 29, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 29, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 56, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 41, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": true, + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "parameterName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 32, + 41, + ], + "type": "TSTypePredicate", + "typeAnnotation": null, + }, + }, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 57, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 22, + ], + "type": "Identifier", + "value": "assertsString", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 39, + ], + "type": "Identifier", + "value": "asserts", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 48, + 54, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-interface.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-interface.src.ts.shot new file mode 100644 index 00000000000..efcdd6e5e9a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-interface.src.ts.shot @@ -0,0 +1,498 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-assertion-in-interface.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "isString", + "optional": false, + "range": Array [ + 24, + 32, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "node", + "optional": false, + "range": Array [ + 33, + 42, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 37, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 24, + 58, + ], + "readonly": false, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 43, + 57, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": true, + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "parameterName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "name": "node", + "optional": false, + "range": Array [ + 53, + 57, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 45, + 57, + ], + "type": "TSTypePredicate", + "typeAnnotation": null, + }, + }, + "static": false, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 60, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "AssertFoo", + "optional": false, + "range": Array [ + 10, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 60, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 61, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 19, + ], + "type": "Identifier", + "value": "AssertFoo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 24, + 32, + ], + "type": "Identifier", + "value": "isString", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 33, + 37, + ], + "type": "Identifier", + "value": "node", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 45, + 52, + ], + "type": "Identifier", + "value": "asserts", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 53, + 57, + ], + "type": "Identifier", + "value": "node", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-method.src.ts.shot new file mode 100644 index 00000000000..c84fa6d40fa --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-in-method.src.ts.shot @@ -0,0 +1,880 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-assertion-in-method.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "isBar", + "optional": false, + "range": Array [ + 21, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 21, + 60, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 49, + 56, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 43, + 60, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 26, + 60, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 28, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": true, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 38, + 42, + ], + "type": "TSThisType", + }, + "range": Array [ + 30, + 42, + ], + "type": "TSTypePredicate", + "typeAnnotation": null, + }, + }, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "isBaz", + "optional": false, + "range": Array [ + 63, + 68, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 63, + 108, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 97, + 104, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 91, + 108, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "params": Array [], + "range": Array [ + 71, + 108, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 73, + 87, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": true, + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 83, + 87, + ], + "type": "TSThisType", + }, + "range": Array [ + 75, + 87, + ], + "type": "TSTypePredicate", + "typeAnnotation": null, + }, + }, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 110, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "AssertsFoo", + "optional": false, + "range": Array [ + 6, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 110, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 111, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 16, + ], + "type": "Identifier", + "value": "AssertsFoo", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 21, + 26, + ], + "type": "Identifier", + "value": "isBar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 30, + 37, + ], + "type": "Identifier", + "value": "asserts", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 38, + 42, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 49, + 55, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 63, + 68, + ], + "type": "Identifier", + "value": "isBaz", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 75, + 82, + ], + "type": "Identifier", + "value": "asserts", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 83, + 87, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 5, + }, + "start": Object { + "column": 27, + "line": 5, + }, + }, + "range": Array [ + 88, + 90, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 91, + 92, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 97, + 103, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-arrow-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-arrow-function.src.ts.shot new file mode 100644 index 00000000000..2b0109966c6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-arrow-function.src.ts.shot @@ -0,0 +1,598 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-assertion-with-guard-in-arrow-function.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "assertString", + "optional": false, + "range": Array [ + 6, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 60, + 66, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 54, + "line": 1, + }, + }, + "range": Array [ + 54, + 68, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 21, + 68, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 50, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": true, + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "parameterName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 31, + 50, + ], + "type": "TSTypePredicate", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 50, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 50, + ], + "type": "TSStringKeyword", + }, + }, + }, + }, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 68, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 68, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 69, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 18, + ], + "type": "Identifier", + "value": "assertString", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "Identifier", + "value": "asserts", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 43, + ], + "type": "Identifier", + "value": "is", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 50, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "range": Array [ + 51, + 53, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 54, + "line": 1, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 60, + 66, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-function.src.ts.shot new file mode 100644 index 00000000000..639bad6d9bc --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-function.src.ts.shot @@ -0,0 +1,523 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-assertion-with-guard-in-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": null, + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 63, + 69, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 57, + "line": 1, + }, + }, + "range": Array [ + 57, + 71, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "assertsStringGuard", + "optional": false, + "range": Array [ + 9, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 28, + 34, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 34, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 71, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 56, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": true, + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "parameterName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 37, + 56, + ], + "type": "TSTypePredicate", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 50, + "line": 1, + }, + }, + "range": Array [ + 50, + 56, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 50, + "line": 1, + }, + }, + "range": Array [ + 50, + 56, + ], + "type": "TSStringKeyword", + }, + }, + }, + }, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 72, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 27, + ], + "type": "Identifier", + "value": "assertsStringGuard", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 34, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 44, + ], + "type": "Identifier", + "value": "asserts", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 49, + ], + "type": "Identifier", + "value": "is", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 50, + "line": 1, + }, + }, + "range": Array [ + 50, + 56, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 1, + }, + "start": Object { + "column": 57, + "line": 1, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 63, + 69, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-interface.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-interface.src.ts.shot new file mode 100644 index 00000000000..7b1f554558a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-interface.src.ts.shot @@ -0,0 +1,567 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-assertion-with-guard-in-interface.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "isString", + "optional": false, + "range": Array [ + 24, + 32, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 46, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "node", + "optional": false, + "range": Array [ + 33, + 42, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 37, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 24, + 68, + ], + "readonly": false, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 43, + 67, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": true, + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "parameterName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "name": "node", + "optional": false, + "range": Array [ + 53, + 57, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 45, + 67, + ], + "type": "TSTypePredicate", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 39, + "line": 2, + }, + }, + "range": Array [ + 61, + 67, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 39, + "line": 2, + }, + }, + "range": Array [ + 61, + 67, + ], + "type": "TSStringKeyword", + }, + }, + }, + }, + "static": false, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 70, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "AssertFoo", + "optional": false, + "range": Array [ + 10, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 70, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 71, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 19, + ], + "type": "Identifier", + "value": "AssertFoo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 24, + 32, + ], + "type": "Identifier", + "value": "isString", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 33, + 37, + ], + "type": "Identifier", + "value": "node", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 45, + 52, + ], + "type": "Identifier", + "value": "asserts", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 53, + 57, + ], + "type": "Identifier", + "value": "node", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 58, + 60, + ], + "type": "Identifier", + "value": "is", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 39, + "line": 2, + }, + }, + "range": Array [ + 61, + 67, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 2, + }, + "start": Object { + "column": 45, + "line": 2, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-method.src.ts.shot new file mode 100644 index 00000000000..4b8449944b0 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-assertion-with-guard-in-method.src.ts.shot @@ -0,0 +1,1018 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-assertion-with-guard-in-method.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "isBar", + "optional": false, + "range": Array [ + 21, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 21, + 70, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 59, + 66, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 53, + 70, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 26, + 70, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 28, + 52, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": true, + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 38, + 42, + ], + "type": "TSThisType", + }, + "range": Array [ + 30, + 52, + ], + "type": "TSTypePredicate", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "TSStringKeyword", + }, + }, + }, + }, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "isBaz", + "optional": false, + "range": Array [ + 73, + 78, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 73, + 128, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 117, + 124, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 40, + "line": 5, + }, + }, + "range": Array [ + 111, + 128, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "params": Array [], + "range": Array [ + 81, + 128, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 83, + 107, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": true, + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 93, + 97, + ], + "type": "TSThisType", + }, + "range": Array [ + 85, + 107, + ], + "type": "TSTypePredicate", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 101, + 107, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 101, + 107, + ], + "type": "TSStringKeyword", + }, + }, + }, + }, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 130, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "AssertsFoo", + "optional": false, + "range": Array [ + 6, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 130, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 131, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 16, + ], + "type": "Identifier", + "value": "AssertsFoo", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 21, + 26, + ], + "type": "Identifier", + "value": "isBar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 30, + 37, + ], + "type": "Identifier", + "value": "asserts", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 38, + 42, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 43, + 45, + ], + "type": "Identifier", + "value": "is", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 59, + 65, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 73, + 78, + ], + "type": "Identifier", + "value": "isBaz", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 85, + 92, + ], + "type": "Identifier", + "value": "asserts", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 93, + 97, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 5, + }, + "start": Object { + "column": 27, + "line": 5, + }, + }, + "range": Array [ + 98, + 100, + ], + "type": "Identifier", + "value": "is", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 101, + 107, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 5, + }, + "start": Object { + "column": 37, + "line": 5, + }, + }, + "range": Array [ + 108, + 110, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 5, + }, + "start": Object { + "column": 40, + "line": 5, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 117, + 123, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 123, + 124, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 127, + 128, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 129, + 130, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-arrow-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-arrow-function.src.ts.shot new file mode 100644 index 00000000000..c4389a3250a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-arrow-function.src.ts.shot @@ -0,0 +1,728 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-guard-in-arrow-function.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "isString", + "optional": false, + "range": Array [ + 6, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "left": Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 62, + 63, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "operator": "typeof", + "prefix": true, + "range": Array [ + 55, + 63, + ], + "type": "UnaryExpression", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "operator": "===", + "range": Array [ + 55, + 76, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 68, + 76, + ], + "raw": "'string'", + "type": "Literal", + "value": "string", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 48, + 76, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 78, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 18, + 24, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 17, + 78, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": false, + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "parameterName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 27, + 38, + ], + "type": "TSTypePredicate", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSStringKeyword", + }, + }, + }, + }, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 78, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 78, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 79, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 14, + ], + "type": "Identifier", + "value": "isString", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "Identifier", + "value": "is", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 41, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 48, + 54, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 55, + 61, + ], + "type": "Keyword", + "value": "typeof", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 64, + 67, + ], + "type": "Punctuator", + "value": "===", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 68, + 76, + ], + "type": "String", + "value": "'string'", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-function.src.ts.shot new file mode 100644 index 00000000000..c4827039bed --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-function.src.ts.shot @@ -0,0 +1,653 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-guard-in-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "left": Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "operator": "typeof", + "prefix": true, + "range": Array [ + 52, + 60, + ], + "type": "UnaryExpression", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "operator": "===", + "range": Array [ + 52, + 73, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 65, + 73, + ], + "raw": "'string'", + "type": "Literal", + "value": "string", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 45, + 73, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 75, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "isString", + "optional": false, + "range": Array [ + 9, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 18, + 24, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 0, + 75, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": false, + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "parameterName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 27, + 38, + ], + "type": "TSTypePredicate", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSStringKeyword", + }, + }, + }, + }, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 75, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 17, + ], + "type": "Identifier", + "value": "isString", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "Identifier", + "value": "is", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 45, + 51, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 52, + 58, + ], + "type": "Keyword", + "value": "typeof", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 61, + 64, + ], + "type": "Punctuator", + "value": "===", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 65, + 73, + ], + "type": "String", + "value": "'string'", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-interface.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-interface.src.ts.shot new file mode 100644 index 00000000000..760f643e1b7 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-interface.src.ts.shot @@ -0,0 +1,549 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-guard-in-interface.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "isString", + "optional": false, + "range": Array [ + 18, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "node", + "optional": false, + "range": Array [ + 27, + 36, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 31, + 36, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 33, + 36, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 18, + 54, + ], + "readonly": false, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 37, + 53, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": false, + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "parameterName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "node", + "optional": false, + "range": Array [ + 39, + 43, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 39, + 53, + ], + "type": "TSTypePredicate", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 47, + 53, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 47, + 53, + ], + "type": "TSStringKeyword", + }, + }, + }, + }, + "static": false, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 56, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 57, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 26, + ], + "type": "Identifier", + "value": "isString", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 27, + 31, + ], + "type": "Identifier", + "value": "node", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 33, + 36, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 39, + 43, + ], + "type": "Identifier", + "value": "node", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 44, + 46, + ], + "type": "Identifier", + "value": "is", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 47, + 53, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-method.src.ts.shot new file mode 100644 index 00000000000..76405ed6613 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-guard-in-method.src.ts.shot @@ -0,0 +1,1200 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-guard-in-method.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "isBar", + "optional": false, + "range": Array [ + 14, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 75, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 51, + 55, + ], + "type": "ThisExpression", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "operator": "instanceof", + "range": Array [ + 51, + 70, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 67, + 70, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 44, + 71, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 75, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 19, + 75, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 37, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": false, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 23, + 27, + ], + "type": "TSThisType", + }, + "range": Array [ + 23, + 37, + ], + "type": "TSTypePredicate", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TSStringKeyword", + }, + }, + }, + }, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "name": "isBaz", + "optional": false, + "range": Array [ + 78, + 83, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 78, + 145, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 121, + 125, + ], + "type": "ThisExpression", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "operator": "instanceof", + "range": Array [ + 121, + 140, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 6, + }, + "start": Object { + "column": 27, + "line": 6, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 137, + 140, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 114, + 141, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 32, + "line": 5, + }, + }, + "range": Array [ + 108, + 145, + ], + "type": "BlockStatement", + }, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "params": Array [], + "range": Array [ + 86, + 145, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 88, + 104, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "asserts": false, + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "parameterName": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 90, + 94, + ], + "type": "TSThisType", + }, + "range": Array [ + 90, + 104, + ], + "type": "TSTypePredicate", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 98, + 104, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 98, + 104, + ], + "type": "TSStringKeyword", + }, + }, + }, + }, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 147, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 147, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 148, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "type": "Identifier", + "value": "isBar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 23, + 27, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 30, + ], + "type": "Identifier", + "value": "is", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 44, + 50, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 51, + 55, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 56, + 66, + ], + "type": "Keyword", + "value": "instanceof", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 67, + 70, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 78, + 83, + ], + "type": "Identifier", + "value": "isBaz", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 10, + "line": 5, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 87, + 88, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 5, + }, + }, + "range": Array [ + 90, + 94, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 95, + 97, + ], + "type": "Identifier", + "value": "is", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 98, + 104, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 5, + }, + "start": Object { + "column": 29, + "line": 5, + }, + }, + "range": Array [ + 105, + 107, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 5, + }, + "start": Object { + "column": 32, + "line": 5, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 114, + 120, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 121, + 125, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 6, + }, + "start": Object { + "column": 16, + "line": 6, + }, + }, + "range": Array [ + 126, + 136, + ], + "type": "Keyword", + "value": "instanceof", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 6, + }, + "start": Object { + "column": 27, + "line": 6, + }, + }, + "range": Array [ + 137, + 140, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 6, + }, + "start": Object { + "column": 30, + "line": 6, + }, + }, + "range": Array [ + 140, + 141, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 2, + "line": 7, + }, + }, + "range": Array [ + 144, + 145, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 146, + 147, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-import-type-with-type-parameters-in-type-reference.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-import-type-with-type-parameters-in-type-reference.src.ts.shot new file mode 100644 index 00000000000..78569c9d383 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-import-type-with-type-parameters-in-type-reference.src.ts.shot @@ -0,0 +1,522 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-import-type-with-type-parameters-in-type-reference.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 29, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "argument": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "raw": "\\"\\"", + "type": "Literal", + "value": "", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "TSLiteralType", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "qualifier": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "B", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 11, + 28, + ], + "type": "TSImportType", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "TSAnyKeyword", + }, + ], + "range": Array [ + 23, + 28, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + ], + "range": Array [ + 10, + 29, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "String", + "value": "\\"\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-import-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-import-type.src.ts.shot new file mode 100644 index 00000000000..3da18228ba4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-import-type.src.ts.shot @@ -0,0 +1,708 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-import-type.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "exprName": Object { + "argument": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 26, + ], + "raw": "'A'", + "type": "Literal", + "value": "A", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "TSLiteralType", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "qualifier": null, + "range": Array [ + 16, + 27, + ], + "type": "TSImportType", + "typeParameters": null, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 27, + ], + "type": "TSTypeQuery", + "typeParameters": undefined, + }, + "typeParameters": undefined, + }, + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "B", + "optional": false, + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 29, + 55, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "argument": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 45, + 48, + ], + "raw": "'B'", + "type": "Literal", + "value": "B", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 45, + 48, + ], + "type": "TSLiteralType", + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "qualifier": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 38, + 54, + ], + "type": "TSImportType", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "Y", + "optional": false, + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 51, + 54, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Keyword", + "value": "typeof", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "String", + "value": "'A'", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 29, + 33, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 45, + 48, + ], + "type": "String", + "value": "'B'", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + "value": "Y", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-only-export-specifiers.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-only-export-specifiers.src.ts.shot new file mode 100644 index 00000000000..fd0197325f6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-only-export-specifiers.src.ts.shot @@ -0,0 +1,386 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-only-export-specifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": null, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 36, + ], + "raw": "\\"mod\\"", + "type": "Literal", + "value": "mod", + }, + "specifiers": Array [ + Object { + "exportKind": "type", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 9, + 15, + ], + "type": "ExportSpecifier", + }, + Object { + "exportKind": "type", + "exported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "B", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "B", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 17, + 23, + ], + "type": "ExportSpecifier", + }, + ], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 30, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 36, + ], + "type": "String", + "value": "\\"mod\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-only-import-specifiers.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-only-import-specifiers.src.ts.shot new file mode 100644 index 00000000000..e250bf09a4e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-only-import-specifiers.src.ts.shot @@ -0,0 +1,385 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-only-import-specifiers.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "value", + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 36, + ], + "raw": "\\"mod\\"", + "type": "Literal", + "value": "mod", + }, + "specifiers": Array [ + Object { + "importKind": "type", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 9, + 15, + ], + "type": "ImportSpecifier", + }, + Object { + "importKind": "type", + "imported": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "B", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "B", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 17, + 23, + ], + "type": "ImportSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 13, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 30, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 36, + ], + "type": "String", + "value": "\\"mod\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-parameters-comments-heritage.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-parameters-comments-heritage.src.ts.shot new file mode 100644 index 00000000000..ae6510407f6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-parameters-comments-heritage.src.ts.shot @@ -0,0 +1,2190 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-parameters-comments-heritage.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 74, + "line": 1, + }, + "start": Object { + "column": 72, + "line": 1, + }, + }, + "range": Array [ + 72, + 74, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 74, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 74, + ], + "superClass": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 43, + 46, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "superTypeParameters": Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 60, + "line": 1, + }, + "start": Object { + "column": 59, + "line": 1, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 60, + "line": 1, + }, + "start": Object { + "column": 59, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 47, + 71, + ], + "type": "TSTypeParameterInstantiation", + }, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 22, + 23, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 10, + 34, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 89, + "line": 2, + }, + "start": Object { + "column": 87, + "line": 2, + }, + }, + "range": Array [ + 162, + 164, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "foo2", + "optional": false, + "range": Array [ + 81, + 85, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 89, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 75, + 164, + ], + "superClass": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 61, + "line": 2, + }, + "start": Object { + "column": 58, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 133, + 136, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "superTypeParameters": Object { + "loc": Object { + "end": Object { + "column": 86, + "line": 2, + }, + "start": Object { + "column": 62, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 75, + "line": 2, + }, + "start": Object { + "column": 74, + "line": 2, + }, + }, + "range": Array [ + 149, + 150, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 75, + "line": 2, + }, + "start": Object { + "column": 74, + "line": 2, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 149, + 150, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 137, + 161, + ], + "type": "TSTypeParameterInstantiation", + }, + "type": "ClassDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 112, + 113, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "TSLiteralType", + }, + "in": false, + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 98, + 99, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 98, + 113, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 86, + 124, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 79, + "line": 3, + }, + "start": Object { + "column": 77, + "line": 3, + }, + }, + "range": Array [ + 242, + 244, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 51, + "line": 3, + }, + "start": Object { + "column": 47, + "line": 3, + }, + }, + "name": "bar2", + "optional": false, + "range": Array [ + 212, + 216, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 76, + "line": 3, + }, + "start": Object { + "column": 47, + "line": 3, + }, + }, + "range": Array [ + 212, + 241, + ], + "type": "TSInterfaceHeritage", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 76, + "line": 3, + }, + "start": Object { + "column": 52, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 3, + }, + "start": Object { + "column": 64, + "line": 3, + }, + }, + "range": Array [ + 229, + 230, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 65, + "line": 3, + }, + "start": Object { + "column": 64, + "line": 3, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 229, + 230, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 217, + 241, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + ], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 175, + 178, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 79, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 165, + 244, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 191, + 192, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 191, + 192, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 179, + 203, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 93, + "line": 4, + }, + "start": Object { + "column": 91, + "line": 4, + }, + }, + "range": Array [ + 336, + 338, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 65, + "line": 4, + }, + "start": Object { + "column": 62, + "line": 4, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 307, + 310, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 90, + "line": 4, + }, + "start": Object { + "column": 62, + "line": 4, + }, + }, + "range": Array [ + 307, + 335, + ], + "type": "TSInterfaceHeritage", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 90, + "line": 4, + }, + "start": Object { + "column": 66, + "line": 4, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 4, + }, + "start": Object { + "column": 78, + "line": 4, + }, + }, + "range": Array [ + 323, + 324, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 79, + "line": 4, + }, + "start": Object { + "column": 78, + "line": 4, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 323, + 324, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 311, + 335, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + ], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "name": "bar2", + "optional": false, + "range": Array [ + 255, + 259, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 93, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 245, + 338, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 41, + "line": 4, + }, + }, + "range": Array [ + 286, + 287, + ], + "raw": "2", + "type": "Literal", + "value": 2, + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 41, + "line": 4, + }, + }, + "range": Array [ + 286, + 287, + ], + "type": "TSLiteralType", + }, + "in": false, + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 272, + 273, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 272, + 287, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 260, + 298, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 21, + ], + "type": "Block", + "value": " aaa ", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 33, + ], + "type": "Block", + "value": " bbb ", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 58, + ], + "type": "Block", + "value": " aaa ", + }, + Object { + "loc": Object { + "end": Object { + "column": 70, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "range": Array [ + 61, + 70, + ], + "type": "Block", + "value": " bbb ", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 88, + 97, + ], + "type": "Block", + "value": " aaa ", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 100, + 109, + ], + "type": "Block", + "value": " bbb ", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 39, + "line": 2, + }, + }, + "range": Array [ + 114, + 123, + ], + "type": "Block", + "value": " bbb ", + }, + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 2, + }, + "start": Object { + "column": 64, + "line": 2, + }, + }, + "range": Array [ + 139, + 148, + ], + "type": "Block", + "value": " aaa ", + }, + Object { + "loc": Object { + "end": Object { + "column": 85, + "line": 2, + }, + "start": Object { + "column": 76, + "line": 2, + }, + }, + "range": Array [ + 151, + 160, + ], + "type": "Block", + "value": " bbb ", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 181, + 190, + ], + "type": "Block", + "value": " aaa ", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 193, + 202, + ], + "type": "Block", + "value": " bbb ", + }, + Object { + "loc": Object { + "end": Object { + "column": 63, + "line": 3, + }, + "start": Object { + "column": 54, + "line": 3, + }, + }, + "range": Array [ + 219, + 228, + ], + "type": "Block", + "value": " aaa ", + }, + Object { + "loc": Object { + "end": Object { + "column": 75, + "line": 3, + }, + "start": Object { + "column": 66, + "line": 3, + }, + }, + "range": Array [ + 231, + 240, + ], + "type": "Block", + "value": " bbb ", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 262, + 271, + ], + "type": "Block", + "value": " aaa ", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 29, + "line": 4, + }, + }, + "range": Array [ + 274, + 283, + ], + "type": "Block", + "value": " bbb ", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 4, + }, + "start": Object { + "column": 43, + "line": 4, + }, + }, + "range": Array [ + 288, + 297, + ], + "type": "Block", + "value": " bbb ", + }, + Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 4, + }, + "start": Object { + "column": 68, + "line": 4, + }, + }, + "range": Array [ + 313, + 322, + ], + "type": "Block", + "value": " aaa ", + }, + Object { + "loc": Object { + "end": Object { + "column": 89, + "line": 4, + }, + "start": Object { + "column": 80, + "line": 4, + }, + }, + "range": Array [ + 325, + 334, + ], + "type": "Block", + "value": " bbb ", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 339, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 42, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 46, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 60, + "line": 1, + }, + "start": Object { + "column": 59, + "line": 1, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 1, + }, + "start": Object { + "column": 70, + "line": 1, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 1, + }, + "start": Object { + "column": 72, + "line": 1, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 1, + }, + "start": Object { + "column": 73, + "line": 1, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 75, + 80, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 81, + 85, + ], + "type": "Identifier", + "value": "foo2", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 2, + }, + "start": Object { + "column": 48, + "line": 2, + }, + }, + "range": Array [ + 123, + 124, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 50, + "line": 2, + }, + }, + "range": Array [ + 125, + 132, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 2, + }, + "start": Object { + "column": 58, + "line": 2, + }, + }, + "range": Array [ + 133, + 136, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 63, + "line": 2, + }, + "start": Object { + "column": 62, + "line": 2, + }, + }, + "range": Array [ + 137, + 138, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 75, + "line": 2, + }, + "start": Object { + "column": 74, + "line": 2, + }, + }, + "range": Array [ + 149, + 150, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 86, + "line": 2, + }, + "start": Object { + "column": 85, + "line": 2, + }, + }, + "range": Array [ + 160, + 161, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 88, + "line": 2, + }, + "start": Object { + "column": 87, + "line": 2, + }, + }, + "range": Array [ + 162, + 163, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 89, + "line": 2, + }, + "start": Object { + "column": 88, + "line": 2, + }, + }, + "range": Array [ + 163, + 164, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 165, + 174, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 175, + 178, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 179, + 180, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 191, + 192, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 3, + }, + "start": Object { + "column": 37, + "line": 3, + }, + }, + "range": Array [ + 202, + 203, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 204, + 211, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 3, + }, + "start": Object { + "column": 47, + "line": 3, + }, + }, + "range": Array [ + 212, + 216, + ], + "type": "Identifier", + "value": "bar2", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 3, + }, + "start": Object { + "column": 52, + "line": 3, + }, + }, + "range": Array [ + 217, + 218, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 3, + }, + "start": Object { + "column": 64, + "line": 3, + }, + }, + "range": Array [ + 229, + 230, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 76, + "line": 3, + }, + "start": Object { + "column": 75, + "line": 3, + }, + }, + "range": Array [ + 240, + 241, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 78, + "line": 3, + }, + "start": Object { + "column": 77, + "line": 3, + }, + }, + "range": Array [ + 242, + 243, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 3, + }, + "start": Object { + "column": 78, + "line": 3, + }, + }, + "range": Array [ + 243, + 244, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 245, + 254, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 255, + 259, + ], + "type": "Identifier", + "value": "bar2", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 260, + 261, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 272, + 273, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 39, + "line": 4, + }, + }, + "range": Array [ + 284, + 285, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 41, + "line": 4, + }, + }, + "range": Array [ + 286, + 287, + ], + "type": "Numeric", + "value": "2", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 4, + }, + "start": Object { + "column": 52, + "line": 4, + }, + }, + "range": Array [ + 297, + 298, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 4, + }, + "start": Object { + "column": 54, + "line": 4, + }, + }, + "range": Array [ + 299, + 306, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 4, + }, + "start": Object { + "column": 62, + "line": 4, + }, + }, + "range": Array [ + 307, + 310, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 67, + "line": 4, + }, + "start": Object { + "column": 66, + "line": 4, + }, + }, + "range": Array [ + 311, + 312, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 4, + }, + "start": Object { + "column": 78, + "line": 4, + }, + }, + "range": Array [ + 323, + 324, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 90, + "line": 4, + }, + "start": Object { + "column": 89, + "line": 4, + }, + }, + "range": Array [ + 334, + 335, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 92, + "line": 4, + }, + "start": Object { + "column": 91, + "line": 4, + }, + }, + "range": Array [ + 336, + 337, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 93, + "line": 4, + }, + "start": Object { + "column": 92, + "line": 4, + }, + }, + "range": Array [ + 337, + 338, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-parameters-comments.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-parameters-comments.src.ts.shot new file mode 100644 index 00000000000..506d536cab3 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-parameters-comments.src.ts.shot @@ -0,0 +1,1022 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-parameters-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 42, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 3, + 40, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "type": "ExpressionStatement", + }, + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 40, + "line": 2, + }, + }, + "range": Array [ + 84, + 87, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 44, + 87, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 68, + 69, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 56, + 81, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 46, + "line": 3, + }, + }, + "range": Array [ + 134, + 137, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 97, + 100, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 88, + 137, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 3, + }, + "start": Object { + "column": 38, + "line": 3, + }, + }, + "range": Array [ + 126, + 129, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 41, + "line": 3, + }, + "start": Object { + "column": 38, + "line": 3, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 126, + 129, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "in": false, + "loc": Object { + "end": Object { + "column": 41, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 112, + 113, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 112, + 129, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 100, + 131, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 20, + ], + "type": "Block", + "value": " comment 1 ", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 38, + ], + "type": "Block", + "value": " comment 2 ", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 58, + 67, + ], + "type": "Block", + "value": " aaa ", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 70, + 79, + ], + "type": "Block", + "value": " bbb ", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 102, + 111, + ], + "type": "Block", + "value": " aaa ", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 114, + 123, + ], + "type": "Block", + "value": " bbb ", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 138, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 44, + 52, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 40, + "line": 2, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 88, + 96, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 97, + 100, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 3, + }, + "start": Object { + "column": 38, + "line": 3, + }, + }, + "range": Array [ + 126, + 129, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 42, + "line": 3, + }, + }, + "range": Array [ + 130, + 131, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 3, + }, + "start": Object { + "column": 43, + "line": 3, + }, + }, + "range": Array [ + 131, + 132, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 44, + "line": 3, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 46, + "line": 3, + }, + }, + "range": Array [ + 134, + 135, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 3, + }, + "start": Object { + "column": 48, + "line": 3, + }, + }, + "range": Array [ + 136, + 137, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-reference-comments.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-reference-comments.src.ts.shot new file mode 100644 index 00000000000..97b337b9834 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-reference-comments.src.ts.shot @@ -0,0 +1,521 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics type-reference-comments.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "mBuffers", + "optional": false, + "range": Array [ + 26, + 34, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 51, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 26, + 75, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 34, + 74, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 36, + 74, + ], + "type": "TSTypeReference", + "typeName": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "name": "interop", + "optional": false, + "range": Array [ + 36, + 43, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 36, + 53, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "name": "Reference", + "optional": false, + "range": Array [ + 44, + 53, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "TSQualifiedName", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 54, + 57, + ], + "type": "TSAnyKeyword", + }, + ], + "range": Array [ + 53, + 74, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 77, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "AudioBufferList", + "optional": false, + "range": Array [ + 6, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 77, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 58, + 73, + ], + "type": "Block", + "value": "AudioBuffer", + }, + ], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 78, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 21, + ], + "type": "Identifier", + "value": "AudioBufferList", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 26, + 34, + ], + "type": "Identifier", + "value": "mBuffers", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 36, + 43, + ], + "type": "Identifier", + "value": "interop", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 44, + 53, + ], + "type": "Identifier", + "value": "Reference", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 54, + 57, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 2, + }, + "start": Object { + "column": 49, + "line": 2, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 2, + }, + "start": Object { + "column": 50, + "line": 2, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-bigint.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-bigint.src.ts.shot new file mode 100644 index 00000000000..16718475226 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-bigint.src.ts.shot @@ -0,0 +1,156 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics typed-keyword-bigint.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSBigIntKeyword", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + "value": "bigint", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-boolean.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-boolean.src.ts.shot new file mode 100644 index 00000000000..6bae375246c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-boolean.src.ts.shot @@ -0,0 +1,156 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics typed-keyword-boolean.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 18, + ], + "type": "TSBooleanKeyword", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 18, + ], + "type": "Identifier", + "value": "boolean", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-false.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-false.src.ts.shot new file mode 100644 index 00000000000..cd61063d33c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-false.src.ts.shot @@ -0,0 +1,175 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics typed-keyword-false.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "TSLiteralType", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "Boolean", + "value": "false", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-never.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-never.src.ts.shot new file mode 100644 index 00000000000..2ef2bc7ac88 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-never.src.ts.shot @@ -0,0 +1,156 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics typed-keyword-never.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "TSNeverKeyword", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "Identifier", + "value": "never", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-null.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-null.src.ts.shot new file mode 100644 index 00000000000..3063803b21a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-null.src.ts.shot @@ -0,0 +1,156 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics typed-keyword-null.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "type": "TSNullKeyword", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "type": "Keyword", + "value": "null", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-number.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-number.src.ts.shot new file mode 100644 index 00000000000..136af862576 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-number.src.ts.shot @@ -0,0 +1,156 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics typed-keyword-number.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSNumberKeyword", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + "value": "number", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-object.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-object.src.ts.shot new file mode 100644 index 00000000000..93ff8619275 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-object.src.ts.shot @@ -0,0 +1,156 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics typed-keyword-object.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSObjectKeyword", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + "value": "object", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-string.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-string.src.ts.shot new file mode 100644 index 00000000000..ef939b6e06d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-string.src.ts.shot @@ -0,0 +1,156 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics typed-keyword-string.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSStringKeyword", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + "value": "string", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-symbol.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-symbol.src.ts.shot new file mode 100644 index 00000000000..293287d670b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-symbol.src.ts.shot @@ -0,0 +1,156 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics typed-keyword-symbol.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSSymbolKeyword", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + "value": "symbol", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-true.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-true.src.ts.shot new file mode 100644 index 00000000000..6c85c788933 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-true.src.ts.shot @@ -0,0 +1,175 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics typed-keyword-true.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "type": "TSLiteralType", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "type": "Boolean", + "value": "true", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-undefined.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-undefined.src.ts.shot new file mode 100644 index 00000000000..83bce206ac9 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-undefined.src.ts.shot @@ -0,0 +1,156 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics typed-keyword-undefined.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 20, + ], + "type": "TSUndefinedKeyword", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 20, + ], + "type": "Identifier", + "value": "undefined", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-unknown.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-unknown.src.ts.shot new file mode 100644 index 00000000000..b32a66f87d3 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-unknown.src.ts.shot @@ -0,0 +1,156 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics typed-keyword-unknown.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 18, + ], + "type": "TSUnknownKeyword", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 18, + ], + "type": "Identifier", + "value": "unknown", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-void.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-void.src.ts.shot new file mode 100644 index 00000000000..3ba4accdf4f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-keyword-void.src.ts.shot @@ -0,0 +1,156 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics typed-keyword-void.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "type": "TSVoidKeyword", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 15, + ], + "type": "Keyword", + "value": "void", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-method-signature.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-method-signature.src.ts.shot new file mode 100644 index 00000000000..252f85afc2c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-method-signature.src.ts.shot @@ -0,0 +1,930 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics typed-method-signature.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 57, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "members": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "h", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 17, + 28, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 20, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 15, + 36, + ], + "readonly": false, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 31, + 35, + ], + "type": "TSVoidKeyword", + }, + }, + "static": false, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "name": "g", + "optional": false, + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 44, + 50, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 47, + 50, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 49, + 50, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 39, + 55, + ], + "readonly": false, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 51, + 54, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "static": false, + "type": "TSMethodSignature", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 41, + 42, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 41, + 42, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 40, + 43, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "range": Array [ + 11, + 57, + ], + "type": "TSTypeLiteral", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 58, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "h", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 31, + 35, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Identifier", + "value": "g", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 44, + 47, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-this.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-this.src.ts.shot new file mode 100644 index 00000000000..cd43c09cf0b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-this.src.ts.shot @@ -0,0 +1,804 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics typed-this.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "name": "addClickListener", + "optional": false, + "range": Array [ + 23, + 39, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 65, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "optional": false, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "name": "onclick", + "optional": false, + "range": Array [ + 40, + 79, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 47, + 79, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "name": "this", + "optional": false, + "range": Array [ + 50, + 60, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 54, + 60, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 56, + 60, + ], + "type": "TSVoidKeyword", + }, + }, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 40, + "line": 2, + }, + }, + "name": "e", + "optional": false, + "range": Array [ + 62, + 70, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 63, + 70, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "range": Array [ + 65, + 70, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "name": "Event", + "optional": false, + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 49, + 79, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 50, + "line": 2, + }, + }, + "range": Array [ + 72, + 79, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 53, + "line": 2, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSFunctionType", + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 23, + 87, + ], + "readonly": false, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 2, + }, + "start": Object { + "column": 58, + "line": 2, + }, + }, + "range": Array [ + 80, + 86, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 2, + }, + "start": Object { + "column": 60, + "line": 2, + }, + }, + "range": Array [ + 82, + 86, + ], + "type": "TSVoidKeyword", + }, + }, + "static": false, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 89, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "UIElement", + "optional": false, + "range": Array [ + 10, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 89, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 90, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 19, + ], + "type": "Identifier", + "value": "UIElement", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 1, + "line": 2, + }, + }, + "range": Array [ + 23, + 39, + ], + "type": "Identifier", + "value": "addClickListener", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 40, + 47, + ], + "type": "Identifier", + "value": "onclick", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 50, + 54, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 56, + 60, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 38, + "line": 2, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 40, + "line": 2, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "range": Array [ + 65, + 70, + ], + "type": "Identifier", + "value": "Event", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 2, + }, + "start": Object { + "column": 48, + "line": 2, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 2, + }, + "start": Object { + "column": 50, + "line": 2, + }, + }, + "range": Array [ + 72, + 74, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 53, + "line": 2, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 2, + }, + "start": Object { + "column": 57, + "line": 2, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 2, + }, + "start": Object { + "column": 58, + "line": 2, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 2, + }, + "start": Object { + "column": 60, + "line": 2, + }, + }, + "range": Array [ + 82, + 86, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 2, + }, + "start": Object { + "column": 64, + "line": 2, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/union-intersection.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/union-intersection.src.ts.shot new file mode 100644 index 00000000000..dd98a273ca8 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/union-intersection.src.ts.shot @@ -0,0 +1,2109 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics union-intersection.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "union", + "optional": false, + "range": Array [ + 4, + 36, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 36, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 36, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSNumberKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 24, + ], + "type": "TSNullKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 36, + ], + "type": "TSUndefinedKeyword", + }, + ], + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 36, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "intersection", + "optional": false, + "range": Array [ + 42, + 71, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 54, + 71, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 56, + 71, + ], + "type": "TSIntersectionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 56, + 62, + ], + "type": "TSNumberKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 65, + 71, + ], + "type": "TSStringKeyword", + }, + ], + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 42, + 71, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 38, + 72, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "precedence1", + "optional": false, + "range": Array [ + 77, + 115, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 88, + 115, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 90, + 115, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 90, + 96, + ], + "type": "TSNumberKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 99, + 115, + ], + "type": "TSIntersectionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 99, + 105, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 35, + "line": 3, + }, + }, + "range": Array [ + 108, + 115, + ], + "type": "TSBooleanKeyword", + }, + ], + }, + ], + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 77, + 115, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 73, + 116, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "name": "precedence2", + "optional": false, + "range": Array [ + 121, + 159, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 132, + 159, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 134, + 159, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 134, + 149, + ], + "type": "TSIntersectionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 134, + 140, + ], + "type": "TSNumberKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "range": Array [ + 143, + 149, + ], + "type": "TSStringKeyword", + }, + ], + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "range": Array [ + 152, + 159, + ], + "type": "TSBooleanKeyword", + }, + ], + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 121, + 159, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 43, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 117, + 160, + ], + "type": "VariableDeclaration", + }, + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "name": "unionLeading", + "optional": false, + "range": Array [ + 167, + 179, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 38, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 162, + 200, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 6, + }, + "start": Object { + "column": 20, + "line": 6, + }, + }, + "range": Array [ + 182, + 199, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 6, + }, + "start": Object { + "column": 22, + "line": 6, + }, + }, + "range": Array [ + 184, + 190, + ], + "type": "TSNumberKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 6, + }, + "start": Object { + "column": 31, + "line": 6, + }, + }, + "range": Array [ + 193, + 199, + ], + "type": "TSStringKeyword", + }, + ], + }, + "typeParameters": undefined, + }, + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "name": "intersectionLeading", + "optional": false, + "range": Array [ + 206, + 225, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 45, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 201, + 246, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 7, + }, + "start": Object { + "column": 27, + "line": 7, + }, + }, + "range": Array [ + 228, + 245, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 7, + }, + "start": Object { + "column": 29, + "line": 7, + }, + }, + "range": Array [ + 230, + 245, + ], + "type": "TSIntersectionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 7, + }, + "start": Object { + "column": 29, + "line": 7, + }, + }, + "range": Array [ + 230, + 236, + ], + "type": "TSNumberKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 7, + }, + "start": Object { + "column": 38, + "line": 7, + }, + }, + "range": Array [ + 239, + 245, + ], + "type": "TSStringKeyword", + }, + ], + }, + ], + }, + "typeParameters": undefined, + }, + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 8, + }, + "start": Object { + "column": 5, + "line": 8, + }, + }, + "name": "unionLeadingSingle", + "optional": false, + "range": Array [ + 252, + 270, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 247, + 282, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 8, + }, + "start": Object { + "column": 26, + "line": 8, + }, + }, + "range": Array [ + 273, + 281, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 8, + }, + "start": Object { + "column": 28, + "line": 8, + }, + }, + "range": Array [ + 275, + 281, + ], + "type": "TSNumberKeyword", + }, + ], + }, + "typeParameters": undefined, + }, + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 9, + }, + "start": Object { + "column": 5, + "line": 9, + }, + }, + "name": "intersectionLeadingSingle", + "optional": false, + "range": Array [ + 288, + 313, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 42, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 283, + 325, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 9, + }, + "start": Object { + "column": 33, + "line": 9, + }, + }, + "range": Array [ + 316, + 324, + ], + "type": "TSIntersectionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 9, + }, + "start": Object { + "column": 35, + "line": 9, + }, + }, + "range": Array [ + 318, + 324, + ], + "type": "TSNumberKeyword", + }, + ], + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 10, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 326, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 9, + ], + "type": "Identifier", + "value": "union", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 24, + ], + "type": "Keyword", + "value": "null", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 36, + ], + "type": "Identifier", + "value": "undefined", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 38, + 41, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 42, + 54, + ], + "type": "Identifier", + "value": "intersection", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 56, + 62, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": "&", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 65, + 71, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 73, + 76, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 77, + 88, + ], + "type": "Identifier", + "value": "precedence1", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 90, + 96, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 99, + 105, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": "&", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 35, + "line": 3, + }, + }, + "range": Array [ + 108, + 115, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 42, + "line": 3, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 117, + 120, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 121, + 132, + ], + "type": "Identifier", + "value": "precedence2", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 134, + 140, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 141, + 142, + ], + "type": "Punctuator", + "value": "&", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "range": Array [ + 143, + 149, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 4, + }, + "start": Object { + "column": 33, + "line": 4, + }, + }, + "range": Array [ + 150, + 151, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "range": Array [ + 152, + 159, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 4, + }, + "start": Object { + "column": 42, + "line": 4, + }, + }, + "range": Array [ + 159, + 160, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 162, + 166, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "range": Array [ + 167, + 179, + ], + "type": "Identifier", + "value": "unionLeading", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 6, + }, + "start": Object { + "column": 18, + "line": 6, + }, + }, + "range": Array [ + 180, + 181, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 6, + }, + "start": Object { + "column": 20, + "line": 6, + }, + }, + "range": Array [ + 182, + 183, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 6, + }, + "start": Object { + "column": 22, + "line": 6, + }, + }, + "range": Array [ + 184, + 190, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 6, + }, + "start": Object { + "column": 29, + "line": 6, + }, + }, + "range": Array [ + 191, + 192, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 6, + }, + "start": Object { + "column": 31, + "line": 6, + }, + }, + "range": Array [ + 193, + 199, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 6, + }, + "start": Object { + "column": 37, + "line": 6, + }, + }, + "range": Array [ + 199, + 200, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 201, + 205, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "range": Array [ + 206, + 225, + ], + "type": "Identifier", + "value": "intersectionLeading", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 7, + }, + "start": Object { + "column": 25, + "line": 7, + }, + }, + "range": Array [ + 226, + 227, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 7, + }, + "start": Object { + "column": 27, + "line": 7, + }, + }, + "range": Array [ + 228, + 229, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 7, + }, + "start": Object { + "column": 29, + "line": 7, + }, + }, + "range": Array [ + 230, + 236, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 7, + }, + "start": Object { + "column": 36, + "line": 7, + }, + }, + "range": Array [ + 237, + 238, + ], + "type": "Punctuator", + "value": "&", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 7, + }, + "start": Object { + "column": 38, + "line": 7, + }, + }, + "range": Array [ + 239, + 245, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 7, + }, + "start": Object { + "column": 44, + "line": 7, + }, + }, + "range": Array [ + 245, + 246, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 247, + 251, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 8, + }, + "start": Object { + "column": 5, + "line": 8, + }, + }, + "range": Array [ + 252, + 270, + ], + "type": "Identifier", + "value": "unionLeadingSingle", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 8, + }, + "start": Object { + "column": 24, + "line": 8, + }, + }, + "range": Array [ + 271, + 272, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 8, + }, + "start": Object { + "column": 26, + "line": 8, + }, + }, + "range": Array [ + 273, + 274, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 8, + }, + "start": Object { + "column": 28, + "line": 8, + }, + }, + "range": Array [ + 275, + 281, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 8, + }, + "start": Object { + "column": 34, + "line": 8, + }, + }, + "range": Array [ + 281, + 282, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 9, + }, + }, + "range": Array [ + 283, + 287, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 9, + }, + "start": Object { + "column": 5, + "line": 9, + }, + }, + "range": Array [ + 288, + 313, + ], + "type": "Identifier", + "value": "intersectionLeadingSingle", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 9, + }, + "start": Object { + "column": 31, + "line": 9, + }, + }, + "range": Array [ + 314, + 315, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 9, + }, + "start": Object { + "column": 33, + "line": 9, + }, + }, + "range": Array [ + 316, + 317, + ], + "type": "Punctuator", + "value": "&", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 9, + }, + "start": Object { + "column": 35, + "line": 9, + }, + }, + "range": Array [ + 318, + 324, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 9, + }, + "start": Object { + "column": 41, + "line": 9, + }, + }, + "range": Array [ + 324, + 325, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/unique-symbol.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/unique-symbol.src.ts.shot new file mode 100644 index 00000000000..e6be3579754 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/unique-symbol.src.ts.shot @@ -0,0 +1,210 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics unique-symbol.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "operator": "unique", + "range": Array [ + 9, + 22, + ], + "type": "TSTypeOperator", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "TSSymbolKeyword", + }, + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Identifier", + "value": "unique", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Identifier", + "value": "symbol", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/unknown-type-annotation.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/unknown-type-annotation.src.ts.shot new file mode 100644 index 00000000000..2a6acdb6186 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/unknown-type-annotation.src.ts.shot @@ -0,0 +1,211 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics unknown-type-annotation.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 4, + 16, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 16, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 16, + ], + "type": "TSUnknownKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 16, + ], + "type": "Identifier", + "value": "unknown", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/var-with-definite-assignment.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/var-with-definite-assignment.src.ts.shot new file mode 100644 index 00000000000..4f5708663e4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/var-with-definite-assignment.src.ts.shot @@ -0,0 +1,633 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics var-with-definite-assignment.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": true, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 6, + 16, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 16, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "type": "TSStringKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 17, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": true, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 22, + 32, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 24, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 32, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 18, + 33, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": true, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 38, + 48, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 40, + 48, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "TSObjectKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 38, + 48, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 34, + 49, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "Identifier", + "value": "object", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/var-with-dotted-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/var-with-dotted-type.src.ts.shot new file mode 100644 index 00000000000..945791f1e11 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/var-with-dotted-type.src.ts.shot @@ -0,0 +1,381 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics var-with-dotted-type.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 4, + 14, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "TSTypeReference", + "typeName": Object { + "left": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 12, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "B", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "TSQualifiedName", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "C", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "TSQualifiedName", + }, + "typeParameters": undefined, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/var-with-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/var-with-type.src.ts.shot new file mode 100644 index 00000000000..22d3088a1ab --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/var-with-type.src.ts.shot @@ -0,0 +1,503 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics var-with-type.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "name", + "optional": false, + "range": Array [ + 4, + 15, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 15, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "TSStringKeyword", + }, + }, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 28, + ], + "raw": "\\"Nicholas\\"", + "type": "Literal", + "value": "Nicholas", + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 28, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 34, + 45, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 37, + 45, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 39, + 45, + ], + "type": "TSStringKeyword", + }, + }, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 48, + 53, + ], + "raw": "\\"Bar\\"", + "type": "Literal", + "value": "Bar", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 53, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 30, + 54, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 55, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 8, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 28, + ], + "type": "String", + "value": "\\"Nicholas\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 30, + 33, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 39, + 45, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 48, + 53, + ], + "type": "String", + "value": "\\"Bar\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/variable-declaration-type-annotation-spacing.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/variable-declaration-type-annotation-spacing.src.ts.shot new file mode 100644 index 00000000000..ee4becfbc89 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/variable-declaration-type-annotation-spacing.src.ts.shot @@ -0,0 +1,211 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics variable-declaration-type-annotation-spacing.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 21, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 21, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 21, + ], + "type": "TSStringKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 21, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 21, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/declare/abstract-class.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/declare/abstract-class.src.ts.shot new file mode 100644 index 00000000000..84d87561a07 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/declare/abstract-class.src.ts.shot @@ -0,0 +1,198 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript declare abstract-class.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": true, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 31, + ], + "type": "ClassBody", + }, + "declare": true, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 23, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 16, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 22, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/declare/class.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/declare/class.src.ts.shot new file mode 100644 index 00000000000..78264807b98 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/declare/class.src.ts.shot @@ -0,0 +1,180 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript declare class.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 22, + ], + "type": "ClassBody", + }, + "declare": true, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 13, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/declare/enum.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/declare/enum.src.ts.shot new file mode 100644 index 00000000000..2fc02c2308f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/declare/enum.src.ts.shot @@ -0,0 +1,293 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript declare enum.src 1`] = ` +Object { + "body": Array [ + Object { + "const": false, + "declare": true, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "members": Array [ + Object { + "computed": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "Bar", + "optional": false, + "range": Array [ + 23, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "initializer": undefined, + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "TSEnumMember", + }, + Object { + "computed": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "Baz", + "optional": false, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "initializer": undefined, + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "TSEnumMember", + }, + ], + "range": Array [ + 0, + 37, + ], + "type": "TSEnumDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 12, + ], + "type": "Keyword", + "value": "enum", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "Identifier", + "value": "Baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/declare/function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/declare/function.src.ts.shot new file mode 100644 index 00000000000..1cf91d345f3 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/declare/function.src.ts.shot @@ -0,0 +1,232 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript declare function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": undefined, + "declare": true, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 28, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 28, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSDeclareFunction", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 16, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 28, + ], + "type": "Keyword", + "value": "void", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/declare/interface.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/declare/interface.src.ts.shot new file mode 100644 index 00000000000..8d50d5601de --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/declare/interface.src.ts.shot @@ -0,0 +1,176 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript declare interface.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 26, + ], + "type": "TSInterfaceBody", + }, + "declare": true, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 17, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/declare/module.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/declare/module.src.ts.shot new file mode 100644 index 00000000000..27c64a55228 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/declare/module.src.ts.shot @@ -0,0 +1,175 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript declare module.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "TSModuleBlock", + }, + "declare": true, + "global": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "type": "TSModuleDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 14, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/declare/namespace.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/declare/namespace.src.ts.shot new file mode 100644 index 00000000000..849614bd130 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/declare/namespace.src.ts.shot @@ -0,0 +1,175 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript declare namespace.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 26, + ], + "type": "TSModuleBlock", + }, + "declare": true, + "global": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "TSModuleDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 17, + ], + "type": "Identifier", + "value": "namespace", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/declare/type-alias.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/declare/type-alias.src.ts.shot new file mode 100644 index 00000000000..b8b43753ae0 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/declare/type-alias.src.ts.shot @@ -0,0 +1,174 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript declare type-alias.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": true, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "TSStringKeyword", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 12, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "Identifier", + "value": "string", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/declare/variable.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/declare/variable.src.ts.shot new file mode 100644 index 00000000000..a243c013741 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/declare/variable.src.ts.shot @@ -0,0 +1,229 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript declare variable.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 12, + 20, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "TSAnyKeyword", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 20, + ], + "type": "VariableDeclarator", + }, + ], + "declare": true, + "kind": "var", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src.ts.shot new file mode 100644 index 00000000000..b1e770513ed --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-factory-instance-member.src.ts.shot @@ -0,0 +1,694 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators accessor-decorators accessor-decorator-factory-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 32, + 37, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "configurable", + "optional": false, + "range": Array [ + 19, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 19, + 38, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 38, + ], + "type": "Decorator", + }, + ], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 18, + 70, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 60, + 64, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "_x", + "optional": false, + "range": Array [ + 65, + 67, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 60, + 67, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 53, + 68, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 51, + 70, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 48, + 70, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 72, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Point", + "optional": false, + "range": Array [ + 6, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 72, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 72, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "Identifier", + "value": "Point", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 19, + 31, + ], + "type": "Identifier", + "value": "configurable", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 32, + 37, + ], + "type": "Boolean", + "value": "false", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 43, + 46, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 60, + 64, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 65, + 67, + ], + "type": "Identifier", + "value": "_x", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.src.ts.shot new file mode 100644 index 00000000000..7d1123ac28e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-factory-static-member.src.ts.shot @@ -0,0 +1,846 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators accessor-decorators accessor-decorator-factory-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 25, + 34, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 30, + 34, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + }, + ], + "range": Array [ + 23, + 36, + ], + "type": "ObjectExpression", + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 19, + 37, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 37, + ], + "type": "Decorator", + }, + ], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 18, + 80, + ], + "static": true, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 68, + 72, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 35, + "line": 3, + }, + }, + "name": "_bar", + "optional": false, + "range": Array [ + 73, + 77, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 68, + 77, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 61, + 78, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 59, + 80, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 56, + 80, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 82, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Other", + "optional": false, + "range": Array [ + 6, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 82, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 82, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 11, + ], + "type": "Identifier", + "value": "Other", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 30, + 34, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 49, + 52, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 53, + 56, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 61, + 67, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 68, + 72, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 3, + }, + "start": Object { + "column": 34, + "line": 3, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 35, + "line": 3, + }, + }, + "range": Array [ + 73, + 77, + ], + "type": "Identifier", + "value": "_bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 3, + }, + "start": Object { + "column": 39, + "line": 3, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 41, + "line": 3, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.src.ts.shot new file mode 100644 index 00000000000..15c4040b246 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-instance-member.src.ts.shot @@ -0,0 +1,600 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators accessor-decorators accessor-decorator-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "hidden", + "optional": false, + "range": Array [ + 15, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Decorator", + }, + ], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 53, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 43, + 47, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "_z", + "optional": false, + "range": Array [ + 48, + 50, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 43, + 50, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 36, + 51, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 34, + 53, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 31, + 53, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 55, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "P", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 55, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 55, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "P", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 21, + ], + "type": "Identifier", + "value": "hidden", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 43, + 47, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 48, + 50, + ], + "type": "Identifier", + "value": "_z", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-static-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-static-member.src.ts.shot new file mode 100644 index 00000000000..e1290fd6d76 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/accessor-decorators/accessor-decorator-static-member.src.ts.shot @@ -0,0 +1,716 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators accessor-decorators accessor-decorator-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "adminonly", + "optional": false, + "range": Array [ + 18, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 27, + ], + "type": "Decorator", + }, + ], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 17, + 76, + ], + "static": true, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 58, + 62, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "name": "_y", + "optional": false, + "range": Array [ + 63, + 65, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 58, + 65, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "operator": "=", + "range": Array [ + 58, + 69, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 58, + 70, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 48, + 76, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 44, + 76, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 78, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "User", + "optional": false, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 78, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 78, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 10, + ], + "type": "Identifier", + "value": "User", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 18, + 27, + ], + "type": "Identifier", + "value": "adminonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 58, + 62, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 63, + 65, + ], + "type": "Identifier", + "value": "_y", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/class-decorator-factory.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/class-decorator-factory.src.ts.shot new file mode 100644 index 00000000000..132245e6798 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/class-decorator-factory.src.ts.shot @@ -0,0 +1,483 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators class-decorators class-decorator-factory.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 56, + 58, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "selector", + "optional": false, + "range": Array [ + 17, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 17, + 32, + ], + "shorthand": false, + "type": "Property", + "value": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 27, + 32, + ], + "raw": "'foo'", + "type": "Literal", + "value": "foo", + }, + }, + ], + "range": Array [ + 11, + 35, + ], + "type": "ObjectExpression", + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "Component", + "optional": false, + "range": Array [ + 1, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 1, + 36, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "type": "Decorator", + }, + ], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "name": "FooComponent", + "optional": false, + "range": Array [ + 43, + 55, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 58, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 58, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 10, + ], + "type": "Identifier", + "value": "Component", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 25, + ], + "type": "Identifier", + "value": "selector", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 27, + 32, + ], + "type": "String", + "value": "'foo'", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 37, + 42, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 43, + 55, + ], + "type": "Identifier", + "value": "FooComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 4, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 20, + "line": 4, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/class-decorator.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/class-decorator.src.ts.shot new file mode 100644 index 00000000000..c5ad448350f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/class-decorator.src.ts.shot @@ -0,0 +1,237 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators class-decorators class-decorator.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "sealed", + "optional": false, + "range": Array [ + 1, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Decorator", + }, + ], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "Qux", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 7, + ], + "type": "Identifier", + "value": "sealed", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 8, + 13, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "Qux", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/class-parameter-property.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/class-parameter-property.src.ts.shot new file mode 100644 index 00000000000..e0f6249be85 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/class-parameter-property.src.ts.shot @@ -0,0 +1,567 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators class-decorators class-parameter-property.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 12, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 12, + 48, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 46, + 48, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [ + Object { + "accessibility": "private", + "decorators": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "name": "d", + "optional": false, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "Decorator", + }, + ], + "export": false, + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "override": false, + "parameter": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 35, + 44, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 36, + 44, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "range": Array [ + 24, + 44, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 23, + 48, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 50, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 12, + 23, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 34, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/export-default-class-decorator.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/export-default-class-decorator.src.ts.shot new file mode 100644 index 00000000000..ef6941711c5 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/export-default-class-decorator.src.ts.shot @@ -0,0 +1,291 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators class-decorators export-default-class-decorator.src 1`] = ` +Object { + "body": Array [ + Object { + "declaration": Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 33, + 35, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "sealed", + "optional": false, + "range": Array [ + 1, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Decorator", + }, + ], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "name": "Qux", + "optional": false, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 23, + 35, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 8, + 35, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 7, + ], + "type": "Identifier", + "value": "sealed", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 8, + 14, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 15, + 22, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 23, + 28, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "value": "Qux", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/export-named-class-decorator.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/export-named-class-decorator.src.ts.shot new file mode 100644 index 00000000000..dba1ae6fd05 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/class-decorators/export-named-class-decorator.src.ts.shot @@ -0,0 +1,276 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators class-decorators export-named-class-decorator.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 25, + 27, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "name": "sealed", + "optional": false, + "range": Array [ + 1, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Decorator", + }, + ], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "Qux", + "optional": false, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 15, + 27, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 8, + 27, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 7, + ], + "type": "Identifier", + "value": "sealed", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 8, + 14, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 21, + 24, + ], + "type": "Identifier", + "value": "Qux", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts.shot new file mode 100644 index 00000000000..fc286d2c5ae --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-factory-instance-member.src.ts.shot @@ -0,0 +1,511 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators method-decorators method-decorator-factory-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 29, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "onlyRead", + "optional": false, + "range": Array [ + 15, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 15, + 30, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 30, + ], + "type": "Decorator", + }, + ], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "instanceMethod", + "optional": false, + "range": Array [ + 35, + 49, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 54, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 52, + 54, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 49, + 54, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 56, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "B", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 57, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 23, + ], + "type": "Identifier", + "value": "onlyRead", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 29, + ], + "type": "Boolean", + "value": "false", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 35, + 49, + ], + "type": "Identifier", + "value": "instanceMethod", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-factory-static-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-factory-static-member.src.ts.shot new file mode 100644 index 00000000000..41f927c3347 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-factory-static-member.src.ts.shot @@ -0,0 +1,529 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators method-decorators method-decorator-factory-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 24, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 15, + 25, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Decorator", + }, + ], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "name": "staticMethod", + "optional": false, + "range": Array [ + 37, + 49, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 54, + ], + "static": true, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 52, + 54, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 49, + 54, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 56, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 57, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 24, + ], + "type": "Boolean", + "value": "false", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 37, + 49, + ], + "type": "Identifier", + "value": "staticMethod", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-instance-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-instance-member.src.ts.shot new file mode 100644 index 00000000000..c8f3fa4ebad --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-instance-member.src.ts.shot @@ -0,0 +1,417 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators method-decorators method-decorator-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "onlyRead", + "optional": false, + "range": Array [ + 15, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 23, + ], + "type": "Decorator", + }, + ], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "instanceMethod", + "optional": false, + "range": Array [ + 28, + 42, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 47, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 45, + 47, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 42, + 47, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 49, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 23, + ], + "type": "Identifier", + "value": "onlyRead", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 28, + 42, + ], + "type": "Identifier", + "value": "instanceMethod", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-static-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-static-member.src.ts.shot new file mode 100644 index 00000000000..98c64e562c2 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/method-decorators/method-decorator-static-member.src.ts.shot @@ -0,0 +1,435 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators method-decorators method-decorator-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Decorator", + }, + ], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "name": "staticMethod", + "optional": false, + "range": Array [ + 30, + 42, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 47, + ], + "static": true, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 45, + 47, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 42, + 47, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 49, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "D", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "D", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 30, + 42, + ], + "type": "Identifier", + "value": "staticMethod", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-array-pattern-decorator.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-array-pattern-decorator.src.ts.shot new file mode 100644 index 00000000000..13e6abc7abc --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-array-pattern-decorator.src.ts.shot @@ -0,0 +1,678 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators parameter-decorators parameter-array-pattern-decorator.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 49, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 47, + 49, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 31, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "name": "special", + "optional": false, + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 19, + 32, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 18, + 32, + ], + "type": "Decorator", + }, + ], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 33, + 45, + ], + "type": "ArrayPattern", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 40, + 45, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 17, + 49, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 51, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + "value": "special", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 31, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-constructor.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-constructor.src.ts.shot new file mode 100644 index 00000000000..fd55d3eb030 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-constructor.src.ts.shot @@ -0,0 +1,943 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators parameter-decorators parameter-decorator-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 20, + 113, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 81, + 85, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "title", + "optional": false, + "range": Array [ + 86, + 91, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 81, + 91, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "operator": "=", + "range": Array [ + 81, + 106, + ], + "right": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "name": "config", + "optional": false, + "range": Array [ + 94, + 100, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "name": "title", + "optional": false, + "range": Array [ + 101, + 106, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 94, + 106, + ], + "type": "MemberExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 81, + 107, + ], + "type": "ExpressionStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 55, + "line": 2, + }, + }, + "range": Array [ + 71, + 113, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "APP_CONFIG", + "optional": false, + "range": Array [ + 40, + 50, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "name": "Inject", + "optional": false, + "range": Array [ + 33, + 39, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 33, + 51, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 51, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "name": "config", + "optional": false, + "range": Array [ + 52, + 69, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "range": Array [ + 58, + 69, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 60, + 69, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "name": "AppConfig", + "optional": false, + "range": Array [ + 60, + 69, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 31, + 113, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 115, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Service", + "optional": false, + "range": Array [ + 6, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 115, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 116, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 13, + ], + "type": "Identifier", + "value": "Service", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 31, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 33, + 39, + ], + "type": "Identifier", + "value": "Inject", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 50, + ], + "type": "Identifier", + "value": "APP_CONFIG", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 52, + 58, + ], + "type": "Identifier", + "value": "config", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 60, + 69, + ], + "type": "Identifier", + "value": "AppConfig", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 2, + }, + "start": Object { + "column": 53, + "line": 2, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 2, + }, + "start": Object { + "column": 55, + "line": 2, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 81, + 85, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 86, + 91, + ], + "type": "Identifier", + "value": "title", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 94, + 100, + ], + "type": "Identifier", + "value": "config", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 28, + "line": 3, + }, + }, + "range": Array [ + 101, + 106, + ], + "type": "Identifier", + "value": "title", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src.ts.shot new file mode 100644 index 00000000000..d796ccc509a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-decorator-instance-member.src.ts.shot @@ -0,0 +1,620 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators parameter-decorators parameter-decorator-decorator-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 16, + 50, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 48, + 50, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 33, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "special", + "optional": false, + "range": Array [ + 21, + 28, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 21, + 34, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 34, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 35, + 46, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 46, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 19, + 50, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 52, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 53, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 28, + ], + "type": "Identifier", + "value": "special", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 29, + 33, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 2, + }, + "start": Object { + "column": 37, + "line": 2, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src.ts.shot new file mode 100644 index 00000000000..9ae0c0b122e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-decorator-static-member.src.ts.shot @@ -0,0 +1,638 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators parameter-decorators parameter-decorator-decorator-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 22, + 63, + ], + "static": true, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "range": Array [ + 61, + 63, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 42, + 46, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "special", + "optional": false, + "range": Array [ + 34, + 41, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 34, + 47, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 33, + 47, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 48, + 59, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 51, + 59, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 32, + 63, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 65, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "StaticFoo", + "optional": false, + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 65, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 66, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 15, + ], + "type": "Identifier", + "value": "StaticFoo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 34, + 41, + ], + "type": "Identifier", + "value": "special", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 42, + 46, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 48, + 51, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 53, + 59, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 2, + }, + "start": Object { + "column": 43, + "line": 2, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.src.ts.shot new file mode 100644 index 00000000000..95d832d6628 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-instance-member.src.ts.shot @@ -0,0 +1,765 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators parameter-decorators parameter-decorator-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "greet", + "optional": false, + "range": Array [ + 20, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 20, + 95, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "left": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 67, + 75, + ], + "raw": "\\"Hello \\"", + "type": "Literal", + "value": "Hello ", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 67, + 82, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "name", + "optional": false, + "range": Array [ + 78, + 82, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 67, + 88, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 85, + 88, + ], + "raw": "\\"!\\"", + "type": "Literal", + "value": "!", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 60, + 89, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 50, + 95, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "required", + "optional": false, + "range": Array [ + 27, + 35, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 26, + 35, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "name": "name", + "optional": false, + "range": Array [ + 36, + 48, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 48, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 25, + 95, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 97, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Greeter", + "optional": false, + "range": Array [ + 6, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 97, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 98, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 13, + ], + "type": "Identifier", + "value": "Greeter", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 25, + ], + "type": "Identifier", + "value": "greet", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 27, + 35, + ], + "type": "Identifier", + "value": "required", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 36, + 40, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 60, + 66, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 67, + 75, + ], + "type": "String", + "value": "\\"Hello \\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 78, + 82, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 31, + "line": 3, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 85, + 88, + ], + "type": "String", + "value": "\\"!\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 94, + 95, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-static-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-static-member.src.ts.shot new file mode 100644 index 00000000000..435a57981b4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-decorator-static-member.src.ts.shot @@ -0,0 +1,783 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators parameter-decorators parameter-decorator-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "greet", + "optional": false, + "range": Array [ + 33, + 38, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 26, + 108, + ], + "static": true, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "left": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 80, + 88, + ], + "raw": "\\"Hello \\"", + "type": "Literal", + "value": "Hello ", + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 80, + 95, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "name": "name", + "optional": false, + "range": Array [ + 91, + 95, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "operator": "+", + "range": Array [ + 80, + 101, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 98, + 101, + ], + "raw": "\\"!\\"", + "type": "Literal", + "value": "!", + }, + "type": "BinaryExpression", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 73, + 102, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 63, + 108, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "name": "required", + "optional": false, + "range": Array [ + 40, + 48, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 39, + 48, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "name": "name", + "optional": false, + "range": Array [ + 49, + 61, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 53, + 61, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 55, + 61, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 38, + 108, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 110, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "StaticGreeter", + "optional": false, + "range": Array [ + 6, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 110, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 111, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 19, + ], + "type": "Identifier", + "value": "StaticGreeter", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 33, + 38, + ], + "type": "Identifier", + "value": "greet", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 40, + 48, + ], + "type": "Identifier", + "value": "required", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 49, + 53, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 55, + 61, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 2, + }, + "start": Object { + "column": 39, + "line": 2, + }, + }, + "range": Array [ + 61, + 62, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 73, + 79, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 80, + 88, + ], + "type": "String", + "value": "\\"Hello \\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 91, + 95, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 31, + "line": 3, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 98, + 101, + ], + "type": "String", + "value": "\\"!\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 101, + 102, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-object-pattern-decorator.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-object-pattern-decorator.src.ts.shot new file mode 100644 index 00000000000..2e7496ff983 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-object-pattern-decorator.src.ts.shot @@ -0,0 +1,721 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators parameter-decorators parameter-object-pattern-decorator.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 49, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 47, + 49, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 31, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "name": "special", + "optional": false, + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 19, + 32, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 18, + 32, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 35, + 38, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 33, + 45, + ], + "type": "ObjectPattern", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 40, + 45, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 17, + 49, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 51, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + "value": "special", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 31, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 35, + 38, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-rest-element-decorator.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-rest-element-decorator.src.ts.shot new file mode 100644 index 00000000000..02508642ae3 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/parameter-decorators/parameter-rest-element-decorator.src.ts.shot @@ -0,0 +1,659 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators parameter-decorators parameter-rest-element-decorator.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 48, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 48, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "params": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 36, + 39, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 31, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "name": "special", + "optional": false, + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 19, + 32, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 18, + 32, + ], + "type": "Decorator", + }, + ], + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 18, + 44, + ], + "type": "RestElement", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 39, + 44, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 41, + 44, + ], + "type": "TSAnyKeyword", + }, + }, + "value": undefined, + }, + ], + "range": Array [ + 17, + 48, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 50, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 19, + 26, + ], + "type": "Identifier", + "value": "special", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 31, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 33, + 36, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 36, + 39, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 41, + 44, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-factory-instance-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-factory-instance-member.src.ts.shot new file mode 100644 index 00000000000..b6ba2ac472c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-factory-instance-member.src.ts.shot @@ -0,0 +1,724 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators property-decorators property-decorator-factory-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "Input", + "optional": false, + "range": Array [ + 27, + 32, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 27, + 34, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 26, + 34, + ], + "type": "Decorator", + }, + ], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "data", + "optional": false, + "range": Array [ + 35, + 39, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 26, + 40, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": null, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "Output", + "optional": false, + "range": Array [ + 46, + 52, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "optional": false, + "range": Array [ + 46, + 54, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 45, + 54, + ], + "type": "Decorator", + }, + ], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "name": "click", + "optional": false, + "range": Array [ + 59, + 64, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 45, + 86, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "name": "EventEmitter", + "optional": false, + "range": Array [ + 71, + 83, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 67, + 85, + ], + "type": "NewExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 88, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "SomeComponent", + "optional": false, + "range": Array [ + 6, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 88, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 88, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 19, + ], + "type": "Identifier", + "value": "SomeComponent", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 27, + 32, + ], + "type": "Identifier", + "value": "Input", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 35, + 39, + ], + "type": "Identifier", + "value": "data", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 46, + 52, + ], + "type": "Identifier", + "value": "Output", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 12, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 59, + 64, + ], + "type": "Identifier", + "value": "click", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 67, + 70, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 71, + 83, + ], + "type": "Identifier", + "value": "EventEmitter", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 4, + }, + "start": Object { + "column": 28, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 4, + }, + "start": Object { + "column": 29, + "line": 4, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 87, + 88, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-factory-static-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-factory-static-member.src.ts.shot new file mode 100644 index 00000000000..cbd4142c313 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-factory-static-member.src.ts.shot @@ -0,0 +1,707 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators property-decorators property-decorator-factory-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 28, + 32, + ], + "raw": "true", + "type": "Literal", + "value": true, + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "configurable", + "optional": false, + "range": Array [ + 15, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 15, + 33, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 33, + ], + "type": "Decorator", + }, + ], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "name": "prop1", + "optional": false, + "range": Array [ + 41, + 46, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 47, + ], + "readonly": false, + "static": true, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": null, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [ + Object { + "expression": Object { + "arguments": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 67, + 72, + ], + "raw": "false", + "type": "Literal", + "value": false, + }, + ], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "name": "configurable", + "optional": false, + "range": Array [ + 54, + 66, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 54, + 73, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 53, + 73, + ], + "type": "Decorator", + }, + ], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "name": "prop2", + "optional": false, + "range": Array [ + 85, + 90, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 53, + 91, + ], + "readonly": false, + "static": true, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 93, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 93, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 93, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 27, + ], + "type": "Identifier", + "value": "configurable", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 28, + 32, + ], + "type": "Boolean", + "value": "true", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 41, + 46, + ], + "type": "Identifier", + "value": "prop1", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 2, + }, + "start": Object { + "column": 36, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 54, + 66, + ], + "type": "Identifier", + "value": "configurable", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 18, + "line": 4, + }, + }, + "range": Array [ + 67, + 72, + ], + "type": "Boolean", + "value": "false", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 78, + 84, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 85, + 90, + ], + "type": "Identifier", + "value": "prop2", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 92, + 93, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-instance-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-instance-member.src.ts.shot new file mode 100644 index 00000000000..0ea7c477352 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-instance-member.src.ts.shot @@ -0,0 +1,483 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators property-decorators property-decorator-instance-member.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Decorator", + }, + ], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 21, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": null, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 26, + 30, + ], + "type": "Decorator", + }, + ], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 26, + 37, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 39, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "B", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-static-member.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-static-member.src.ts.shot new file mode 100644 index 00000000000..00b6cb8accb --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/decorators/property-decorators/property-decorator-static-member.src.ts.shot @@ -0,0 +1,519 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript decorators property-decorators property-decorator-static-member.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Decorator", + }, + ], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 28, + ], + "readonly": false, + "static": true, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": null, + }, + Object { + "accessibility": undefined, + "computed": false, + "declare": false, + "decorators": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "qux", + "optional": false, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 33, + 37, + ], + "type": "Decorator", + }, + ], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 49, + 50, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 33, + 51, + ], + "readonly": false, + "static": true, + "type": "PropertyDefinition", + "typeAnnotation": undefined, + "value": null, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 53, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "C", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 53, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 54, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "value": "qux", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 4, + }, + "start": Object { + "column": 12, + "line": 4, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-empty-extends-implements.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-empty-extends-implements.src.ts.shot new file mode 100644 index 00000000000..1bd37272699 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-empty-extends-implements.src.ts.shot @@ -0,0 +1,256 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery class-empty-extends-implements.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 37, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "Bar", + "optional": false, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "TSClassImplements", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 17, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 28, + ], + "type": "Keyword", + "value": "implements", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-empty-extends.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-empty-extends.src.ts.shot new file mode 100644 index 00000000000..3e03c06505a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-empty-extends.src.ts.shot @@ -0,0 +1,180 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery class-empty-extends.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 22, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 17, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-extends-empty-implements.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-extends-empty-implements.src.ts.shot new file mode 100644 index 00000000000..bc24a042d3e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-extends-empty-implements.src.ts.shot @@ -0,0 +1,236 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery class-extends-empty-implements.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 37, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "superClass": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "Bar", + "optional": false, + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 17, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + "value": "Bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 32, + ], + "type": "Keyword", + "value": "implements", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-multiple-implements.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-multiple-implements.src.ts.shot new file mode 100644 index 00000000000..a9266f6761f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/class-multiple-implements.src.ts.shot @@ -0,0 +1,274 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery class-multiple-implements.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 36, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "TSClassImplements", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 18, + ], + "type": "Keyword", + "value": "implements", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 31, + ], + "type": "Keyword", + "value": "implements", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-enum-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-enum-declaration.src.ts.shot new file mode 100644 index 00000000000..bf9719e0e4d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-enum-declaration.src.ts.shot @@ -0,0 +1,176 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery decorator-on-enum-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "const": false, + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "E", + "optional": false, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "members": Array [], + "range": Array [ + 0, + 14, + ], + "type": "TSEnumDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "Identifier", + "value": "dec", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 9, + ], + "type": "Keyword", + "value": "enum", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "E", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-function.src.ts.shot new file mode 100644 index 00000000000..c8a92c1fa3c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-function.src.ts.shot @@ -0,0 +1,234 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery decorator-on-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 17, + 19, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 19, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 4, + ], + "type": "Identifier", + "value": "dec", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 5, + 13, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-interface-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-interface-declaration.src.ts.shot new file mode 100644 index 00000000000..ec47840850a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-interface-declaration.src.ts.shot @@ -0,0 +1,230 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery decorator-on-interface-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "M", + "optional": false, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 5, + ], + "type": "Identifier", + "value": "deco", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 8, + 17, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "M", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-variable.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-variable.src.ts.shot new file mode 100644 index 00000000000..a50ff86e3b6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/decorator-on-variable.src.ts.shot @@ -0,0 +1,250 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery decorator-on-variable.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 14, + 19, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "@", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 5, + ], + "type": "Identifier", + "value": "deco", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 8, + 13, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Numeric", + "value": "1", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-arguments-in-call-expression.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-arguments-in-call-expression.src.ts.shot new file mode 100644 index 00000000000..2c09af5f398 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-arguments-in-call-expression.src.ts.shot @@ -0,0 +1,211 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery empty-type-arguments-in-call-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 7, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 3, + 5, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-arguments-in-new-expression.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-arguments-in-new-expression.src.ts.shot new file mode 100644 index 00000000000..93860b87c8b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-arguments-in-new-expression.src.ts.shot @@ -0,0 +1,210 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery empty-type-arguments-in-new-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "NewExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 7, + 9, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ")", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-arguments.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-arguments.src.ts.shot new file mode 100644 index 00000000000..45e46b0c970 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-arguments.src.ts.shot @@ -0,0 +1,268 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery empty-type-arguments.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 6, + 16, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 16, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 16, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 14, + 16, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 16, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 14, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ">", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-arrow-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-arrow-function.src.ts.shot new file mode 100644 index 00000000000..62578efead5 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-arrow-function.src.ts.shot @@ -0,0 +1,251 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery empty-type-parameters-in-arrow-function.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f1", + "optional": false, + "range": Array [ + 9, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 18, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 11, + 13, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Identifier", + "value": "f1", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-constructor.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-constructor.src.ts.shot new file mode 100644 index 00000000000..a4efe957148 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-constructor.src.ts.shot @@ -0,0 +1,395 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery empty-type-parameters-in-constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 32, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 30, + 32, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 25, + 32, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 25, + 27, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 34, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 25, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-function-expression.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-function-expression.src.ts.shot new file mode 100644 index 00000000000..864e243a7e8 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-function-expression.src.ts.shot @@ -0,0 +1,327 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery empty-type-parameters-in-function-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 27, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 12, + 27, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 20, + 22, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 27, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 20, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-method-signature.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-method-signature.src.ts.shot new file mode 100644 index 00000000000..4bfcb929485 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-method-signature.src.ts.shot @@ -0,0 +1,332 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery empty-type-parameters-in-method-signature.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "test", + "optional": false, + "range": Array [ + 18, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "params": Array [], + "range": Array [ + 18, + 27, + ], + "readonly": false, + "returnType": undefined, + "static": false, + "type": "TSMethodSignature", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 22, + 24, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 29, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 22, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-method.src.ts.shot new file mode 100644 index 00000000000..9a77a16527e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters-in-method.src.ts.shot @@ -0,0 +1,395 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery empty-type-parameters-in-method.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "test", + "optional": false, + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 14, + 25, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 18, + 25, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 18, + 20, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 27, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 9, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 14, + 18, + ], + "type": "Identifier", + "value": "test", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters.src.ts.shot new file mode 100644 index 00000000000..4dd8d5a0b2c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/empty-type-parameters.src.ts.shot @@ -0,0 +1,251 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery empty-type-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "f1", + "optional": false, + "range": Array [ + 9, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 0, + 18, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 11, + 13, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 8, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 11, + ], + "type": "Identifier", + "value": "f1", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/enum-with-keywords.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/enum-with-keywords.src.ts.shot new file mode 100644 index 00000000000..f6ee5e0b2c4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/enum-with-keywords.src.ts.shot @@ -0,0 +1,305 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery enum-with-keywords.src 1`] = ` +Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "const": false, + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 68, + "line": 1, + }, + }, + "name": "X", + "optional": false, + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 72, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "members": Array [], + "range": Array [ + 7, + 72, + ], + "type": "TSEnumDeclaration", + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 72, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 72, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 72, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 72, + ], + "sourceType": "module", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 14, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 21, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 31, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 47, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 48, + "line": 1, + }, + }, + "range": Array [ + 48, + 56, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 62, + "line": 1, + }, + "start": Object { + "column": 57, + "line": 1, + }, + }, + "range": Array [ + 57, + 62, + ], + "type": "Identifier", + "value": "async", + }, + Object { + "loc": Object { + "end": Object { + "column": 67, + "line": 1, + }, + "start": Object { + "column": 63, + "line": 1, + }, + }, + "range": Array [ + 63, + 67, + ], + "type": "Keyword", + "value": "enum", + }, + Object { + "loc": Object { + "end": Object { + "column": 69, + "line": 1, + }, + "start": Object { + "column": 68, + "line": 1, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Identifier", + "value": "X", + }, + Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 1, + }, + "start": Object { + "column": 70, + "line": 1, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 72, + "line": 1, + }, + "start": Object { + "column": 71, + "line": 1, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/index-signature-parameters.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/index-signature-parameters.src.ts.shot new file mode 100644 index 00000000000..b883986f4e2 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/index-signature-parameters.src.ts.shot @@ -0,0 +1,557 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery index-signature-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "members": Array [ + Object { + "accessibility": undefined, + "export": false, + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "parameters": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 16, + 25, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 25, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "TSStringKeyword", + }, + }, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 27, + 36, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 28, + 36, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 15, + 46, + ], + "readonly": false, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 37, + 45, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 39, + 45, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 11, + 48, + ], + "type": "TSTypeLiteral", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 39, + 45, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-empty-extends.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-empty-extends.src.ts.shot new file mode 100644 index 00000000000..5c37a401de1 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-empty-extends.src.ts.shot @@ -0,0 +1,176 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery interface-empty-extends.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 26, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-implements.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-implements.src.ts.shot new file mode 100644 index 00000000000..6cab0a70e5f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-implements.src.ts.shot @@ -0,0 +1,194 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery interface-implements.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 27, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "d", + "optional": false, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 22, + ], + "type": "Keyword", + "value": "implements", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "e", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-export.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-export.src.ts.shot new file mode 100644 index 00000000000..a516da8fd01 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-export.src.ts.shot @@ -0,0 +1,432 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery interface-index-signature-export.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "export": true, + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "parameters": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 26, + 37, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 29, + 37, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 18, + 47, + ], + "readonly": false, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 38, + 46, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 49, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 24, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-private.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-private.src.ts.shot new file mode 100644 index 00000000000..e06857bbd7b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-private.src.ts.shot @@ -0,0 +1,432 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery interface-index-signature-private.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": "private", + "export": false, + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "parameters": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 27, + 38, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 30, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 18, + 48, + ], + "readonly": false, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 39, + 47, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 41, + 47, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 50, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 25, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 41, + 47, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-protected.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-protected.src.ts.shot new file mode 100644 index 00000000000..04c38fdea4a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-protected.src.ts.shot @@ -0,0 +1,432 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery interface-index-signature-protected.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": "protected", + "export": false, + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "parameters": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 29, + 40, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 40, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 18, + 50, + ], + "readonly": false, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 41, + 49, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 43, + 49, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 52, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 54, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 27, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 43, + 49, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-public.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-public.src.ts.shot new file mode 100644 index 00000000000..f03d9d10a9c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-public.src.ts.shot @@ -0,0 +1,432 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery interface-index-signature-public.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": "public", + "export": false, + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "parameters": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 26, + 37, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 29, + 37, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 18, + 47, + ], + "readonly": false, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 38, + 46, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 49, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 24, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-static.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-static.src.ts.shot new file mode 100644 index 00000000000..81cf1090cc6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-index-signature-static.src.ts.shot @@ -0,0 +1,432 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery interface-index-signature-static.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "export": false, + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "parameters": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 26, + 37, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 29, + 37, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 18, + 47, + ], + "readonly": false, + "static": true, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 38, + 46, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 49, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 24, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 26, + 29, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-export.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-export.src.ts.shot new file mode 100644 index 00000000000..629a050332e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-export.src.ts.shot @@ -0,0 +1,475 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery interface-method-export.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": true, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "g", + "optional": false, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 29, + 40, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 40, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 20, + 48, + ], + "readonly": false, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 41, + 47, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 43, + 47, + ], + "type": "TSVoidKeyword", + }, + }, + "static": false, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 50, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 26, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "value": "g", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 43, + 47, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-private.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-private.src.ts.shot new file mode 100644 index 00000000000..b812425f1e2 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-private.src.ts.shot @@ -0,0 +1,475 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery interface-method-private.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": "private", + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "name": "g", + "optional": false, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 30, + 41, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 33, + 41, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 20, + 49, + ], + "readonly": false, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 44, + 48, + ], + "type": "TSVoidKeyword", + }, + }, + "static": false, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 51, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 53, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 27, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "value": "g", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 30, + 33, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 44, + 48, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-protected.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-protected.src.ts.shot new file mode 100644 index 00000000000..df9ea8a3ca4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-protected.src.ts.shot @@ -0,0 +1,475 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery interface-method-protected.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": "protected", + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "name": "g", + "optional": false, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 30, + 41, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 33, + 41, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 18, + 49, + ], + "readonly": false, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 42, + 48, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 44, + 48, + ], + "type": "TSVoidKeyword", + }, + }, + "static": false, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 51, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 53, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 27, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "value": "g", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 30, + 33, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 44, + 48, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-public.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-public.src.ts.shot new file mode 100644 index 00000000000..2a67eb873bb --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-public.src.ts.shot @@ -0,0 +1,475 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery interface-method-public.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": "public", + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "g", + "optional": false, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 29, + 40, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 40, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 20, + 48, + ], + "readonly": false, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 41, + 47, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 43, + 47, + ], + "type": "TSVoidKeyword", + }, + }, + "static": false, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 50, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 52, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 26, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "value": "g", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 43, + 47, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-readonly.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-readonly.src.ts.shot new file mode 100644 index 00000000000..ecb26e58be2 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-readonly.src.ts.shot @@ -0,0 +1,475 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery interface-method-readonly.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "g", + "optional": false, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 29, + 40, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 40, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 18, + 48, + ], + "readonly": true, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 41, + 47, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 43, + 47, + ], + "type": "TSVoidKeyword", + }, + }, + "static": false, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 50, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 26, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "value": "g", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 43, + 47, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 31, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-static.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-static.src.ts.shot new file mode 100644 index 00000000000..34440f37119 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-method-static.src.ts.shot @@ -0,0 +1,475 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery interface-method-static.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "g", + "optional": false, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 27, + 38, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 30, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 18, + 46, + ], + "readonly": false, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 39, + 45, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 41, + 45, + ], + "type": "TSVoidKeyword", + }, + }, + "static": true, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 48, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 24, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "g", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 41, + 45, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-multiple-extends.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-multiple-extends.src.ts.shot new file mode 100644 index 00000000000..282c743b38e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-multiple-extends.src.ts.shot @@ -0,0 +1,309 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery interface-multiple-extends.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 40, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [ + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "TSInterfaceHeritage", + "typeParameters": undefined, + }, + Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "name": "baz", + "optional": false, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "TSInterfaceHeritage", + "typeParameters": undefined, + }, + ], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 25, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 33, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 37, + ], + "type": "Identifier", + "value": "baz", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-export.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-export.src.ts.shot new file mode 100644 index 00000000000..257598e4688 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-export.src.ts.shot @@ -0,0 +1,328 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery interface-property-export.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": true, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 18, + 35, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 26, + 34, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 28, + 34, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 37, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 24, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 28, + 34, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-private.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-private.src.ts.shot new file mode 100644 index 00000000000..2650e9af820 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-private.src.ts.shot @@ -0,0 +1,328 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery interface-property-private.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": "private", + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 18, + 36, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 27, + 35, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 38, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 25, + ], + "type": "Keyword", + "value": "private", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-protected.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-protected.src.ts.shot new file mode 100644 index 00000000000..6538b7b3659 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-protected.src.ts.shot @@ -0,0 +1,328 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery interface-property-protected.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": "protected", + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 18, + 38, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 29, + 37, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 40, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 27, + ], + "type": "Keyword", + "value": "protected", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 31, + 37, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-public.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-public.src.ts.shot new file mode 100644 index 00000000000..29b3d54a1ca --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-public.src.ts.shot @@ -0,0 +1,328 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery interface-property-public.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": "public", + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 20, + 37, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 28, + 36, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 39, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 26, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-static.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-static.src.ts.shot new file mode 100644 index 00000000000..b51bb812a72 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-static.src.ts.shot @@ -0,0 +1,328 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery interface-property-static.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 18, + 35, + ], + "readonly": false, + "static": true, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 26, + 34, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 28, + 34, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 37, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 24, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 28, + 34, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-with-default-value.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-with-default-value.src.ts.shot new file mode 100644 index 00000000000..64aeed4e3d2 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-property-with-default-value.src.ts.shot @@ -0,0 +1,364 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery interface-property-with-default-value.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "initializer": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 35, + ], + "raw": "'a'", + "type": "Literal", + "value": "a", + }, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 18, + 36, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 21, + 29, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 38, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 35, + ], + "type": "String", + "value": "'a'", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-with-optional-index-signature.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-with-optional-index-signature.src.ts.shot new file mode 100644 index 00000000000..e36e4a5be9b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/interface-with-optional-index-signature.src.ts.shot @@ -0,0 +1,432 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery interface-with-optional-index-signature.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "export": false, + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "parameters": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "name": "fff", + "optional": true, + "range": Array [ + 19, + 31, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 23, + 31, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 18, + 41, + ], + "readonly": false, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 40, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 43, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Identifier", + "value": "fff", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/object-assertion-not-allowed.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/object-assertion-not-allowed.src.ts.shot new file mode 100644 index 00000000000..54343656d5c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/object-assertion-not-allowed.src.ts.shot @@ -0,0 +1,329 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery object-assertion-not-allowed.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 2, + 4, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 1, + 5, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 1, + 10, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 8, + 10, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "!", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ")", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/object-optional-not-allowed.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/object-optional-not-allowed.src.ts.shot new file mode 100644 index 00000000000..eb90daf1aa4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/object-optional-not-allowed.src.ts.shot @@ -0,0 +1,329 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery object-optional-not-allowed.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 2, + 4, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 1, + 5, + ], + "type": "ObjectPattern", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "operator": "=", + "range": Array [ + 1, + 10, + ], + "right": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "properties": Array [], + "range": Array [ + 8, + 10, + ], + "type": "ObjectExpression", + }, + "type": "AssignmentExpression", + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ")", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/solo-const.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/solo-const.src.ts.shot new file mode 100644 index 00000000000..1b638349b82 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/errorRecovery/solo-const.src.ts.shot @@ -0,0 +1,65 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript errorRecovery solo-const.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/expressions/call-expression-type-arguments.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/expressions/call-expression-type-arguments.src.ts.shot new file mode 100644 index 00000000000..7c214e71e32 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/expressions/call-expression-type-arguments.src.ts.shot @@ -0,0 +1,489 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript expressions call-expression-type-arguments.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 8, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 3, + 6, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 10, + 23, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 13, + 21, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 10, + 24, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/expressions/instantiation-expression.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/expressions/instantiation-expression.src.ts.shot new file mode 100644 index 00000000000..75ed4901410 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/expressions/instantiation-expression.src.ts.shot @@ -0,0 +1,2391 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript expressions instantiation-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 1, + 4, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 8, + 12, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 9, + 12, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 7, + 16, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 13, + 16, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 7, + 17, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 20, + 23, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 18, + 29, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 24, + 27, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 18, + 30, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "expression": Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 32, + 36, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 33, + 36, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 31, + 40, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 37, + 40, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "optional": true, + "range": Array [ + 31, + 44, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 31, + 44, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 31, + 45, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 47, + 51, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "range": Array [ + 47, + 51, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "range": Array [ + 47, + 54, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 51, + 54, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "optional": false, + "range": Array [ + 46, + 60, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "name": "d", + "optional": false, + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 55, + 58, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 46, + 61, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "arguments": Array [], + "callee": Object { + "expression": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 67, + 68, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "range": Array [ + 67, + 71, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 68, + 71, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 62, + 77, + ], + "type": "NewExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 73, + 74, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 72, + 75, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 62, + 78, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 79, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 40, + 42, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 48, + 50, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 62, + 65, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 7, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/expressions/new-expression-type-arguments.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/expressions/new-expression-type-arguments.src.ts.shot new file mode 100644 index 00000000000..0c5811985c5 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/expressions/new-expression-type-arguments.src.ts.shot @@ -0,0 +1,382 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript expressions new-expression-type-arguments.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 20, + ], + "type": "NewExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "B", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 15, + 18, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 20, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "const", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "const", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 13, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/expressions/optional-call-expression-type-arguments.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/expressions/optional-call-expression-type-arguments.src.ts.shot new file mode 100644 index 00000000000..f7794772ecf --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/expressions/optional-call-expression-type-arguments.src.ts.shot @@ -0,0 +1,675 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript expressions optional-call-expression-type-arguments.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 0, + 8, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 0, + 13, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 8, + 11, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "ExpressionStatement", + }, + Object { + "directive": undefined, + "expression": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "object": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "optional": true, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 15, + 23, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "optional": false, + "range": Array [ + 15, + 33, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 24, + 30, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 23, + 31, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 15, + 33, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 15, + 34, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 5, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 15, + 18, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 24, + 30, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/expressions/tagged-template-expression-type-arguments.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/expressions/tagged-template-expression-type-arguments.src.ts.shot new file mode 100644 index 00000000000..79df088d98f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/expressions/tagged-template-expression-type-arguments.src.ts.shot @@ -0,0 +1,291 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript expressions tagged-template-expression-type-arguments.src 1`] = ` +Object { + "body": Array [ + Object { + "directive": undefined, + "expression": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "quasi": Object { + "expressions": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 13, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "baz", + "raw": "baz", + }, + }, + ], + "range": Array [ + 8, + 13, + ], + "type": "TemplateLiteral", + }, + "range": Array [ + 0, + 13, + ], + "tag": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "TaggedTemplateExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 3, + 8, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 13, + ], + "type": "Template", + "value": "\`baz\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts.shot new file mode 100644 index 00000000000..4990086e943 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/ambient-module-declaration-with-import.src.ts.shot @@ -0,0 +1,342 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript namespaces-and-modules ambient-module-declaration-with-import.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "assertions": Array [], + "importKind": "value", + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 34, + 54, + ], + "source": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 49, + 53, + ], + "raw": "'fs'", + "type": "Literal", + "value": "fs", + }, + "specifiers": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "local": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "fs", + "optional": false, + "range": Array [ + 41, + 43, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 41, + 43, + ], + "type": "ImportDefaultSpecifier", + }, + ], + "type": "ImportDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 56, + ], + "type": "TSModuleBlock", + }, + "declare": true, + "global": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 29, + ], + "raw": "\\"i-use-things\\"", + "type": "Literal", + "value": "i-use-things", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "type": "TSModuleDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 57, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 14, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 29, + ], + "type": "String", + "value": "\\"i-use-things\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 34, + 40, + ], + "type": "Keyword", + "value": "import", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 41, + 43, + ], + "type": "Identifier", + "value": "fs", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 44, + 48, + ], + "type": "Identifier", + "value": "from", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 49, + 53, + ], + "type": "String", + "value": "'fs'", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/declare-namespace-with-exported-function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/declare-namespace-with-exported-function.src.ts.shot new file mode 100644 index 00000000000..5f47122f26e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/declare-namespace-with-exported-function.src.ts.shot @@ -0,0 +1,640 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript namespaces-and-modules declare-namespace-with-exported-function.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "async": false, + "body": undefined, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "name": "select", + "optional": false, + "range": Array [ + 41, + 47, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 59, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "selector", + "optional": false, + "range": Array [ + 48, + 64, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 56, + 64, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 32, + 82, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "range": Array [ + 65, + 81, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 67, + 81, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "name": "Selection", + "optional": false, + "range": Array [ + 67, + 76, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 2, + }, + "start": Object { + "column": 53, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 54, + "line": 2, + }, + }, + "range": Array [ + 77, + 80, + ], + "type": "TSAnyKeyword", + }, + ], + "range": Array [ + 76, + 81, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + "type": "TSDeclareFunction", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 59, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 25, + 82, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 84, + ], + "type": "TSModuleBlock", + }, + "declare": true, + "global": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "d3", + "optional": false, + "range": Array [ + 18, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 84, + ], + "type": "TSModuleDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 84, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 17, + ], + "type": "Identifier", + "value": "namespace", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 20, + ], + "type": "Identifier", + "value": "d3", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 32, + 40, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 41, + 47, + ], + "type": "Identifier", + "value": "select", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 48, + 56, + ], + "type": "Identifier", + "value": "selector", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 35, + "line": 2, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 44, + "line": 2, + }, + }, + "range": Array [ + 67, + 76, + ], + "type": "Identifier", + "value": "Selection", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 2, + }, + "start": Object { + "column": 53, + "line": 2, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 2, + }, + "start": Object { + "column": 54, + "line": 2, + }, + }, + "range": Array [ + 77, + 80, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 2, + }, + "start": Object { + "column": 57, + "line": 2, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 2, + }, + "start": Object { + "column": 58, + "line": 2, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/global-module-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/global-module-declaration.src.ts.shot new file mode 100644 index 00000000000..7dfc6f3a45f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/global-module-declaration.src.ts.shot @@ -0,0 +1,454 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript namespaces-and-modules global-module-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 43, + 51, + ], + "type": "TSModuleBlock", + }, + "declare": true, + "global": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "name": "global", + "optional": false, + "range": Array [ + 36, + 42, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 51, + ], + "type": "TSModuleDeclaration", + }, + Object { + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 29, + "line": 5, + }, + }, + "range": Array [ + 81, + 89, + ], + "type": "TSModuleBlock", + }, + "declare": true, + "global": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "name": "global", + "optional": false, + "range": Array [ + 74, + 80, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 56, + 89, + ], + "type": "TSModuleDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 91, + ], + "type": "TSModuleBlock", + }, + "declare": true, + "global": true, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "global", + "optional": false, + "range": Array [ + 8, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 91, + ], + "type": "TSModuleDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 9, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 92, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 14, + ], + "type": "Identifier", + "value": "global", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 21, + 28, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "Identifier", + "value": "global", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 56, + 63, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 64, + 73, + ], + "type": "Identifier", + "value": "namespace", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 22, + "line": 5, + }, + }, + "range": Array [ + 74, + 80, + ], + "type": "Identifier", + "value": "global", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 5, + }, + "start": Object { + "column": 29, + "line": 5, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 8, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/module-with-default-exports.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/module-with-default-exports.src.ts.shot new file mode 100644 index 00000000000..b7e172473d1 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/module-with-default-exports.src.ts.shot @@ -0,0 +1,859 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript namespaces-and-modules module-with-default-exports.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "declaration": Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "method", + "optional": false, + "range": Array [ + 52, + 58, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 52, + 66, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 64, + 66, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "params": Array [], + "range": Array [ + 58, + 66, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 60, + 63, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "name": "C", + "optional": false, + "range": Array [ + 62, + 63, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 42, + 73, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "C", + "optional": false, + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 34, + 73, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 73, + ], + "type": "ExportDefaultDeclaration", + }, + Object { + "declaration": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 34, + "line": 5, + }, + }, + "range": Array [ + 108, + 110, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 5, + }, + "start": Object { + "column": 28, + "line": 5, + }, + }, + "name": "bar", + "optional": false, + "range": Array [ + 102, + 105, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "params": Array [], + "range": Array [ + 93, + 110, + ], + "returnType": undefined, + "type": "FunctionDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 78, + 110, + ], + "type": "ExportDefaultDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 112, + ], + "type": "TSModuleBlock", + }, + "declare": false, + "global": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 112, + ], + "type": "TSModuleDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 114, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 26, + 33, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 34, + 39, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 52, + 58, + ], + "type": "Identifier", + "value": "method", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Identifier", + "value": "C", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 21, + "line": 3, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 78, + 84, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 85, + 92, + ], + "type": "Keyword", + "value": "default", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 93, + 101, + ], + "type": "Keyword", + "value": "function", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 5, + }, + "start": Object { + "column": 28, + "line": 5, + }, + }, + "range": Array [ + 102, + 105, + ], + "type": "Identifier", + "value": "bar", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 5, + }, + "start": Object { + "column": 31, + "line": 5, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 5, + }, + "start": Object { + "column": 32, + "line": 5, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 5, + }, + "start": Object { + "column": 34, + "line": 5, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 35, + "line": 5, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 111, + 112, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/nested-internal-module.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/nested-internal-module.src.ts.shot new file mode 100644 index 00000000000..722a1fb0276 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/nested-internal-module.src.ts.shot @@ -0,0 +1,1511 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript namespaces-and-modules nested-internal-module.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 31, + 44, + ], + "raw": "'hello world'", + "type": "Literal", + "value": "hello world", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 27, + 44, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 23, + 44, + ], + "type": "VariableDeclaration", + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 16, + 44, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + Object { + "assertions": Array [], + "declaration": Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": "constructor", + "optional": false, + "range": Array [ + 78, + 89, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "constructor", + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 78, + 129, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [], + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 56, + "line": 5, + }, + }, + "range": Array [ + 126, + 129, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "params": Array [ + Object { + "accessibility": "public", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "override": false, + "parameter": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 27, + "line": 5, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 97, + 106, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 28, + "line": 5, + }, + }, + "range": Array [ + 98, + 106, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 100, + 106, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "range": Array [ + 90, + 106, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + Object { + "accessibility": "public", + "decorators": Array [], + "export": false, + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "override": false, + "parameter": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 45, + "line": 5, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 115, + 124, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 46, + "line": 5, + }, + }, + "range": Array [ + 116, + 124, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 48, + "line": 5, + }, + }, + "range": Array [ + 118, + 124, + ], + "type": "TSNumberKeyword", + }, + }, + }, + "range": Array [ + 108, + 124, + ], + "readonly": false, + "static": false, + "type": "TSParameterProperty", + }, + ], + "range": Array [ + 89, + 129, + ], + "returnType": undefined, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 68, + 135, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "name": "Point", + "optional": false, + "range": Array [ + 62, + 67, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 56, + 135, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 49, + 135, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + Object { + "assertions": Array [], + "declaration": Object { + "body": Object { + "body": Array [ + Object { + "assertions": Array [], + "declaration": Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "name": "name", + "optional": false, + "range": Array [ + 200, + 204, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "optional": false, + "range": Array [ + 200, + 213, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 9, + }, + }, + "range": Array [ + 204, + 212, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 9, + }, + "start": Object { + "column": 18, + "line": 9, + }, + }, + "range": Array [ + 206, + 212, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 28, + "line": 8, + }, + }, + "range": Array [ + 186, + 223, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 8, + }, + "start": Object { + "column": 25, + "line": 8, + }, + }, + "name": "Id", + "optional": false, + "range": Array [ + 183, + 185, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 173, + 223, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + "exportKind": "type", + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 166, + 223, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 156, + 229, + ], + "type": "TSModuleBlock", + }, + "declare": false, + "global": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 18, + "line": 7, + }, + }, + "name": "B", + "optional": false, + "range": Array [ + 154, + 155, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 147, + 229, + ], + "type": "TSModuleDeclaration", + }, + "exportKind": "value", + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 140, + 229, + ], + "source": null, + "specifiers": Array [], + "type": "ExportNamedDeclaration", + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 231, + ], + "type": "TSModuleBlock", + }, + "declare": false, + "global": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 231, + ], + "type": "TSModuleDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 231, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 6, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 19, + "line": 3, + }, + }, + "range": Array [ + 31, + 44, + ], + "type": "String", + "value": "'hello world'", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 49, + 55, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 56, + 61, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 62, + 67, + ], + "type": "Identifier", + "value": "Point", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 78, + 89, + ], + "type": "Identifier", + "value": "constructor", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 5, + }, + "start": Object { + "column": 19, + "line": 5, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 5, + }, + "start": Object { + "column": 20, + "line": 5, + }, + }, + "range": Array [ + 90, + 96, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 5, + }, + "start": Object { + "column": 27, + "line": 5, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 5, + }, + "start": Object { + "column": 28, + "line": 5, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 100, + 106, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 5, + }, + "start": Object { + "column": 36, + "line": 5, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 5, + }, + "start": Object { + "column": 38, + "line": 5, + }, + }, + "range": Array [ + 108, + 114, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 45, + "line": 5, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 5, + }, + "start": Object { + "column": 46, + "line": 5, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 5, + }, + "start": Object { + "column": 48, + "line": 5, + }, + }, + "range": Array [ + 118, + 124, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 54, + "line": 5, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 5, + }, + "start": Object { + "column": 56, + "line": 5, + }, + }, + "range": Array [ + 126, + 127, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 5, + }, + "start": Object { + "column": 58, + "line": 5, + }, + }, + "range": Array [ + 128, + 129, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 134, + 135, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 140, + 146, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 147, + 153, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 7, + }, + "start": Object { + "column": 18, + "line": 7, + }, + }, + "range": Array [ + 154, + 155, + ], + "type": "Identifier", + "value": "B", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 7, + }, + "start": Object { + "column": 20, + "line": 7, + }, + }, + "range": Array [ + 156, + 157, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 8, + }, + "start": Object { + "column": 8, + "line": 8, + }, + }, + "range": Array [ + 166, + 172, + ], + "type": "Keyword", + "value": "export", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 8, + }, + "start": Object { + "column": 15, + "line": 8, + }, + }, + "range": Array [ + 173, + 182, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 8, + }, + "start": Object { + "column": 25, + "line": 8, + }, + }, + "range": Array [ + 183, + 185, + ], + "type": "Identifier", + "value": "Id", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 8, + }, + "start": Object { + "column": 28, + "line": 8, + }, + }, + "range": Array [ + 186, + 187, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 12, + "line": 9, + }, + }, + "range": Array [ + 200, + 204, + ], + "type": "Identifier", + "value": "name", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 9, + }, + }, + "range": Array [ + 204, + 205, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 9, + }, + "start": Object { + "column": 18, + "line": 9, + }, + }, + "range": Array [ + 206, + 212, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 9, + }, + "start": Object { + "column": 24, + "line": 9, + }, + }, + "range": Array [ + 212, + 213, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 10, + }, + "start": Object { + "column": 8, + "line": 10, + }, + }, + "range": Array [ + 222, + 223, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 11, + }, + "start": Object { + "column": 4, + "line": 11, + }, + }, + "range": Array [ + 228, + 229, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 12, + }, + "start": Object { + "column": 0, + "line": 12, + }, + }, + "range": Array [ + 230, + 231, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts.shot new file mode 100644 index 00000000000..948f990fb52 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/namespaces-and-modules/shorthand-ambient-module-declaration.src.ts.shot @@ -0,0 +1,137 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript namespaces-and-modules shorthand-ambient-module-declaration.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": true, + "global": false, + "id": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 31, + ], + "raw": "\\"hot-new-module\\"", + "type": "Literal", + "value": "hot-new-module", + }, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "type": "TSModuleDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 7, + ], + "type": "Identifier", + "value": "declare", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 14, + ], + "type": "Identifier", + "value": "module", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 31, + ], + "type": "String", + "value": "\\"hot-new-module\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/array-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/array-type.src.ts.shot new file mode 100644 index 00000000000..661e8e4736c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/array-type.src.ts.shot @@ -0,0 +1,209 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types array-type.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSStringKeyword", + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 19, + ], + "type": "TSArrayType", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 20, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "]", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-nested.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-nested.src.ts.shot new file mode 100644 index 00000000000..911eba05248 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-nested.src.ts.shot @@ -0,0 +1,1350 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types conditional-infer-nested.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Unpacked", + "optional": false, + "range": Array [ + 5, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 126, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "extendsType": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 32, + 39, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 38, + 39, + ], + "type": "TSTypeParameter", + }, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 31, + 42, + ], + "type": "TSArrayType", + }, + "falseType": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 63, + 70, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 69, + 70, + ], + "type": "TSTypeParameter", + }, + }, + "falseType": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 83, + 84, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 93, + 109, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "name": "Promise", + "optional": false, + "range": Array [ + 93, + 100, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 101, + 108, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 107, + 108, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 107, + 108, + ], + "type": "TSTypeParameter", + }, + }, + ], + "range": Array [ + 100, + 109, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 124, + 125, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 83, + 125, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 112, + 113, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "type": "TSConditionalType", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 53, + 125, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 73, + 74, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "type": "TSConditionalType", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 21, + 125, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "type": "TSConditionalType", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 14, + 15, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 13, + 16, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 127, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 13, + ], + "type": "Identifier", + "value": "Unpacked", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 23, + 30, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 32, + 37, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 55, + 62, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 3, + }, + "start": Object { + "column": 14, + "line": 3, + }, + }, + "range": Array [ + 63, + 68, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 22, + "line": 3, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 85, + 92, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 93, + 100, + ], + "type": "Identifier", + "value": "Promise", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 100, + 101, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 101, + 106, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "range": Array [ + 107, + 108, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 31, + "line": 4, + }, + }, + "range": Array [ + 108, + 109, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 4, + }, + "start": Object { + "column": 33, + "line": 4, + }, + }, + "range": Array [ + 110, + 111, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "range": Array [ + 112, + 113, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 37, + "line": 4, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 124, + 125, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 125, + 126, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-simple.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-simple.src.ts.shot new file mode 100644 index 00000000000..895938f15da --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-simple.src.ts.shot @@ -0,0 +1,932 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types conditional-infer-simple.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 63, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 63, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "members": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 26, + 37, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 36, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 36, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 35, + 36, + ], + "type": "TSTypeParameter", + }, + }, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 38, + 48, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 48, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 48, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 47, + 48, + ], + "type": "TSTypeParameter", + }, + }, + }, + }, + ], + "range": Array [ + 24, + 50, + ], + "type": "TSTypeLiteral", + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 62, + "line": 1, + }, + "start": Object { + "column": 57, + "line": 1, + }, + }, + "range": Array [ + 57, + 62, + ], + "type": "TSNeverKeyword", + }, + "loc": Object { + "end": Object { + "column": 62, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 62, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 53, + "line": 1, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 53, + "line": 1, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "type": "TSConditionalType", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 9, + 10, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 8, + 11, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 64, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 34, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 46, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 50, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 53, + "line": 1, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 1, + }, + "start": Object { + "column": 55, + "line": 1, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 62, + "line": 1, + }, + "start": Object { + "column": 57, + "line": 1, + }, + }, + "range": Array [ + 57, + 62, + ], + "type": "Identifier", + "value": "never", + }, + Object { + "loc": Object { + "end": Object { + "column": 63, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-with-constraint.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-with-constraint.src.ts.shot new file mode 100644 index 00000000000..522c462a14b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-with-constraint.src.ts.shot @@ -0,0 +1,4267 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types conditional-infer-with-constraint.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "X3", + "optional": false, + "range": Array [ + 5, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 74, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 74, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "extendsType": Object { + "elementTypes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 46, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "TSNumberKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 30, + 46, + ], + "type": "TSTypeParameter", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 47, + ], + "type": "TSTupleType", + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 1, + }, + "start": Object { + "column": 68, + "line": 1, + }, + }, + "range": Array [ + 68, + 73, + ], + "type": "TSNeverKeyword", + }, + "loc": Object { + "end": Object { + "column": 73, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 73, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 1, + }, + "start": Object { + "column": 50, + "line": 1, + }, + }, + "range": Array [ + 50, + 65, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 62, + "line": 1, + }, + "start": Object { + "column": 50, + "line": 1, + }, + }, + "name": "MustBeNumber", + "optional": false, + "range": Array [ + 50, + 62, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 63, + "line": 1, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 63, + "line": 1, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 63, + 64, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 62, + 65, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "type": "TSConditionalType", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 8, + 9, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 7, + 10, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "X4", + "optional": false, + "range": Array [ + 80, + 82, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 98, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 75, + 173, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 88, + 89, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "extendsType": Object { + "elementTypes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 99, + 121, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 2, + }, + "start": Object { + "column": 40, + "line": 2, + }, + }, + "range": Array [ + 115, + 121, + ], + "type": "TSNumberKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 46, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 105, + 106, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 105, + 121, + ], + "type": "TSTypeParameter", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 70, + "line": 2, + }, + "start": Object { + "column": 48, + "line": 2, + }, + }, + "range": Array [ + 123, + 145, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 70, + "line": 2, + }, + "start": Object { + "column": 64, + "line": 2, + }, + }, + "range": Array [ + 139, + 145, + ], + "type": "TSNumberKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 70, + "line": 2, + }, + "start": Object { + "column": 54, + "line": 2, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 55, + "line": 2, + }, + "start": Object { + "column": 54, + "line": 2, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 129, + 130, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 129, + 145, + ], + "type": "TSTypeParameter", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 71, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 98, + 146, + ], + "type": "TSTupleType", + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 97, + "line": 2, + }, + "start": Object { + "column": 92, + "line": 2, + }, + }, + "range": Array [ + 167, + 172, + ], + "type": "TSNeverKeyword", + }, + "loc": Object { + "end": Object { + "column": 97, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 88, + 172, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 89, + "line": 2, + }, + "start": Object { + "column": 74, + "line": 2, + }, + }, + "range": Array [ + 149, + 164, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 86, + "line": 2, + }, + "start": Object { + "column": 74, + "line": 2, + }, + }, + "name": "MustBeNumber", + "optional": false, + "range": Array [ + 149, + 161, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 89, + "line": 2, + }, + "start": Object { + "column": 86, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 88, + "line": 2, + }, + "start": Object { + "column": 87, + "line": 2, + }, + }, + "range": Array [ + 162, + 163, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 88, + "line": 2, + }, + "start": Object { + "column": 87, + "line": 2, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 162, + 163, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 161, + 164, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "type": "TSConditionalType", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 83, + 84, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 83, + 84, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 82, + 85, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "X5", + "optional": false, + "range": Array [ + 179, + 181, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 83, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 174, + 257, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 187, + 188, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 187, + 188, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "extendsType": Object { + "elementTypes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 198, + 220, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 40, + "line": 3, + }, + }, + "range": Array [ + 214, + 220, + ], + "type": "TSNumberKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 204, + 205, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 204, + 220, + ], + "type": "TSTypeParameter", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 3, + }, + "start": Object { + "column": 48, + "line": 3, + }, + }, + "range": Array [ + 222, + 229, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 55, + "line": 3, + }, + "start": Object { + "column": 54, + "line": 3, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 55, + "line": 3, + }, + "start": Object { + "column": 54, + "line": 3, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 228, + 229, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 228, + 229, + ], + "type": "TSTypeParameter", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 56, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 197, + 230, + ], + "type": "TSTupleType", + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 82, + "line": 3, + }, + "start": Object { + "column": 77, + "line": 3, + }, + }, + "range": Array [ + 251, + 256, + ], + "type": "TSNeverKeyword", + }, + "loc": Object { + "end": Object { + "column": 82, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 187, + 256, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 3, + }, + "start": Object { + "column": 59, + "line": 3, + }, + }, + "range": Array [ + 233, + 248, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 71, + "line": 3, + }, + "start": Object { + "column": 59, + "line": 3, + }, + }, + "name": "MustBeNumber", + "optional": false, + "range": Array [ + 233, + 245, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 3, + }, + "start": Object { + "column": 71, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 3, + }, + "start": Object { + "column": 72, + "line": 3, + }, + }, + "range": Array [ + 246, + 247, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 73, + "line": 3, + }, + "start": Object { + "column": 72, + "line": 3, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 246, + 247, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 245, + 248, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "type": "TSConditionalType", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 182, + 183, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 182, + 183, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 181, + 184, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "name": "X6", + "optional": false, + "range": Array [ + 263, + 265, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 83, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 258, + 341, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 271, + 272, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 271, + 272, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "extendsType": Object { + "elementTypes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 282, + 289, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 288, + 289, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 288, + 289, + ], + "type": "TSTypeParameter", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 4, + }, + "start": Object { + "column": 33, + "line": 4, + }, + }, + "range": Array [ + 291, + 313, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 4, + }, + "start": Object { + "column": 49, + "line": 4, + }, + }, + "range": Array [ + 307, + 313, + ], + "type": "TSNumberKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 55, + "line": 4, + }, + "start": Object { + "column": 39, + "line": 4, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 39, + "line": 4, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 297, + 298, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 297, + 313, + ], + "type": "TSTypeParameter", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 56, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 281, + 314, + ], + "type": "TSTupleType", + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 82, + "line": 4, + }, + "start": Object { + "column": 77, + "line": 4, + }, + }, + "range": Array [ + 335, + 340, + ], + "type": "TSNeverKeyword", + }, + "loc": Object { + "end": Object { + "column": 82, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 271, + 340, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 4, + }, + "start": Object { + "column": 59, + "line": 4, + }, + }, + "range": Array [ + 317, + 332, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 71, + "line": 4, + }, + "start": Object { + "column": 59, + "line": 4, + }, + }, + "name": "MustBeNumber", + "optional": false, + "range": Array [ + 317, + 329, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 4, + }, + "start": Object { + "column": 71, + "line": 4, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 4, + }, + "start": Object { + "column": 72, + "line": 4, + }, + }, + "range": Array [ + 330, + 331, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 73, + "line": 4, + }, + "start": Object { + "column": 72, + "line": 4, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 330, + 331, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 329, + 332, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "type": "TSConditionalType", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 266, + 267, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 266, + 267, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 265, + 268, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "name": "X7", + "optional": false, + "range": Array [ + 347, + 349, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 84, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 342, + 426, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 355, + 356, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 355, + 356, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "extendsType": Object { + "elementTypes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 24, + "line": 5, + }, + }, + "range": Array [ + 366, + 388, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 40, + "line": 5, + }, + }, + "range": Array [ + 382, + 388, + ], + "type": "TSStringKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 372, + 373, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 372, + 388, + ], + "type": "TSTypeParameter", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 70, + "line": 5, + }, + "start": Object { + "column": 48, + "line": 5, + }, + }, + "range": Array [ + 390, + 412, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 70, + "line": 5, + }, + "start": Object { + "column": 64, + "line": 5, + }, + }, + "range": Array [ + 406, + 412, + ], + "type": "TSNumberKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 70, + "line": 5, + }, + "start": Object { + "column": 54, + "line": 5, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 54, + "line": 5, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 396, + 397, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 396, + 412, + ], + "type": "TSTypeParameter", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 71, + "line": 5, + }, + "start": Object { + "column": 23, + "line": 5, + }, + }, + "range": Array [ + 365, + 413, + ], + "type": "TSTupleType", + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 83, + "line": 5, + }, + "start": Object { + "column": 78, + "line": 5, + }, + }, + "range": Array [ + 420, + 425, + ], + "type": "TSNeverKeyword", + }, + "loc": Object { + "end": Object { + "column": 83, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 355, + 425, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 75, + "line": 5, + }, + "start": Object { + "column": 74, + "line": 5, + }, + }, + "range": Array [ + 416, + 417, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 75, + "line": 5, + }, + "start": Object { + "column": 74, + "line": 5, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 416, + 417, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "type": "TSConditionalType", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 350, + 351, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 350, + 351, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 349, + 352, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 427, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 7, + ], + "type": "Identifier", + "value": "X3", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 22, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 29, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 39, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 1, + }, + "start": Object { + "column": 48, + "line": 1, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 62, + "line": 1, + }, + "start": Object { + "column": 50, + "line": 1, + }, + }, + "range": Array [ + 50, + 62, + ], + "type": "Identifier", + "value": "MustBeNumber", + }, + Object { + "loc": Object { + "end": Object { + "column": 63, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 63, + "line": 1, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 1, + }, + "start": Object { + "column": 64, + "line": 1, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 67, + "line": 1, + }, + "start": Object { + "column": 66, + "line": 1, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 1, + }, + "start": Object { + "column": 68, + "line": 1, + }, + }, + "range": Array [ + 68, + 73, + ], + "type": "Identifier", + "value": "never", + }, + Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 1, + }, + "start": Object { + "column": 73, + "line": 1, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 80, + 82, + ], + "type": "Identifier", + "value": "X4", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 90, + 97, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 99, + 104, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 107, + 114, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 2, + }, + "start": Object { + "column": 40, + "line": 2, + }, + }, + "range": Array [ + 115, + 121, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 2, + }, + "start": Object { + "column": 46, + "line": 2, + }, + }, + "range": Array [ + 121, + 122, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 48, + "line": 2, + }, + }, + "range": Array [ + 123, + 128, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 2, + }, + "start": Object { + "column": 54, + "line": 2, + }, + }, + "range": Array [ + 129, + 130, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 63, + "line": 2, + }, + "start": Object { + "column": 56, + "line": 2, + }, + }, + "range": Array [ + 131, + 138, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 70, + "line": 2, + }, + "start": Object { + "column": 64, + "line": 2, + }, + }, + "range": Array [ + 139, + 145, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 2, + }, + "start": Object { + "column": 70, + "line": 2, + }, + }, + "range": Array [ + 145, + 146, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 2, + }, + "start": Object { + "column": 72, + "line": 2, + }, + }, + "range": Array [ + 147, + 148, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 86, + "line": 2, + }, + "start": Object { + "column": 74, + "line": 2, + }, + }, + "range": Array [ + 149, + 161, + ], + "type": "Identifier", + "value": "MustBeNumber", + }, + Object { + "loc": Object { + "end": Object { + "column": 87, + "line": 2, + }, + "start": Object { + "column": 86, + "line": 2, + }, + }, + "range": Array [ + 161, + 162, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 88, + "line": 2, + }, + "start": Object { + "column": 87, + "line": 2, + }, + }, + "range": Array [ + 162, + 163, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 89, + "line": 2, + }, + "start": Object { + "column": 88, + "line": 2, + }, + }, + "range": Array [ + 163, + 164, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 91, + "line": 2, + }, + "start": Object { + "column": 90, + "line": 2, + }, + }, + "range": Array [ + 165, + 166, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 97, + "line": 2, + }, + "start": Object { + "column": 92, + "line": 2, + }, + }, + "range": Array [ + 167, + 172, + ], + "type": "Identifier", + "value": "never", + }, + Object { + "loc": Object { + "end": Object { + "column": 98, + "line": 2, + }, + "start": Object { + "column": 97, + "line": 2, + }, + }, + "range": Array [ + 172, + 173, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 174, + 178, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 179, + 181, + ], + "type": "Identifier", + "value": "X5", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 181, + 182, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 182, + 183, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 183, + 184, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 185, + 186, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 187, + 188, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 189, + 196, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 197, + 198, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 198, + 203, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 204, + 205, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 32, + "line": 3, + }, + }, + "range": Array [ + 206, + 213, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 40, + "line": 3, + }, + }, + "range": Array [ + 214, + 220, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 46, + "line": 3, + }, + }, + "range": Array [ + 220, + 221, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 3, + }, + "start": Object { + "column": 48, + "line": 3, + }, + }, + "range": Array [ + 222, + 227, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 3, + }, + "start": Object { + "column": 54, + "line": 3, + }, + }, + "range": Array [ + 228, + 229, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 3, + }, + "start": Object { + "column": 55, + "line": 3, + }, + }, + "range": Array [ + 229, + 230, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 3, + }, + "start": Object { + "column": 57, + "line": 3, + }, + }, + "range": Array [ + 231, + 232, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 3, + }, + "start": Object { + "column": 59, + "line": 3, + }, + }, + "range": Array [ + 233, + 245, + ], + "type": "Identifier", + "value": "MustBeNumber", + }, + Object { + "loc": Object { + "end": Object { + "column": 72, + "line": 3, + }, + "start": Object { + "column": 71, + "line": 3, + }, + }, + "range": Array [ + 245, + 246, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 3, + }, + "start": Object { + "column": 72, + "line": 3, + }, + }, + "range": Array [ + 246, + 247, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 3, + }, + "start": Object { + "column": 73, + "line": 3, + }, + }, + "range": Array [ + 247, + 248, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 76, + "line": 3, + }, + "start": Object { + "column": 75, + "line": 3, + }, + }, + "range": Array [ + 249, + 250, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 82, + "line": 3, + }, + "start": Object { + "column": 77, + "line": 3, + }, + }, + "range": Array [ + 251, + 256, + ], + "type": "Identifier", + "value": "never", + }, + Object { + "loc": Object { + "end": Object { + "column": 83, + "line": 3, + }, + "start": Object { + "column": 82, + "line": 3, + }, + }, + "range": Array [ + 256, + 257, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 258, + 262, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 263, + 265, + ], + "type": "Identifier", + "value": "X6", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 265, + 266, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 266, + 267, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 267, + 268, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 269, + 270, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 271, + 272, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 273, + 280, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 281, + 282, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 282, + 287, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "range": Array [ + 288, + 289, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 31, + "line": 4, + }, + }, + "range": Array [ + 289, + 290, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 33, + "line": 4, + }, + }, + "range": Array [ + 291, + 296, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 39, + "line": 4, + }, + }, + "range": Array [ + 297, + 298, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 4, + }, + "start": Object { + "column": 41, + "line": 4, + }, + }, + "range": Array [ + 299, + 306, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 4, + }, + "start": Object { + "column": 49, + "line": 4, + }, + }, + "range": Array [ + 307, + 313, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 4, + }, + "start": Object { + "column": 55, + "line": 4, + }, + }, + "range": Array [ + 313, + 314, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 4, + }, + "start": Object { + "column": 57, + "line": 4, + }, + }, + "range": Array [ + 315, + 316, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 4, + }, + "start": Object { + "column": 59, + "line": 4, + }, + }, + "range": Array [ + 317, + 329, + ], + "type": "Identifier", + "value": "MustBeNumber", + }, + Object { + "loc": Object { + "end": Object { + "column": 72, + "line": 4, + }, + "start": Object { + "column": 71, + "line": 4, + }, + }, + "range": Array [ + 329, + 330, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 4, + }, + "start": Object { + "column": 72, + "line": 4, + }, + }, + "range": Array [ + 330, + 331, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 4, + }, + "start": Object { + "column": 73, + "line": 4, + }, + }, + "range": Array [ + 331, + 332, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 76, + "line": 4, + }, + "start": Object { + "column": 75, + "line": 4, + }, + }, + "range": Array [ + 333, + 334, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 82, + "line": 4, + }, + "start": Object { + "column": 77, + "line": 4, + }, + }, + "range": Array [ + 335, + 340, + ], + "type": "Identifier", + "value": "never", + }, + Object { + "loc": Object { + "end": Object { + "column": 83, + "line": 4, + }, + "start": Object { + "column": 82, + "line": 4, + }, + }, + "range": Array [ + 340, + 341, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 342, + 346, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 347, + 349, + ], + "type": "Identifier", + "value": "X7", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 349, + 350, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 350, + 351, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 351, + 352, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 353, + 354, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 355, + 356, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 357, + 364, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 23, + "line": 5, + }, + }, + "range": Array [ + 365, + 366, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 5, + }, + "start": Object { + "column": 24, + "line": 5, + }, + }, + "range": Array [ + 366, + 371, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 372, + 373, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 5, + }, + "start": Object { + "column": 32, + "line": 5, + }, + }, + "range": Array [ + 374, + 381, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 40, + "line": 5, + }, + }, + "range": Array [ + 382, + 388, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 5, + }, + "start": Object { + "column": 46, + "line": 5, + }, + }, + "range": Array [ + 388, + 389, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 5, + }, + "start": Object { + "column": 48, + "line": 5, + }, + }, + "range": Array [ + 390, + 395, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 54, + "line": 5, + }, + }, + "range": Array [ + 396, + 397, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 63, + "line": 5, + }, + "start": Object { + "column": 56, + "line": 5, + }, + }, + "range": Array [ + 398, + 405, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 70, + "line": 5, + }, + "start": Object { + "column": 64, + "line": 5, + }, + }, + "range": Array [ + 406, + 412, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 5, + }, + "start": Object { + "column": 70, + "line": 5, + }, + }, + "range": Array [ + 412, + 413, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 5, + }, + "start": Object { + "column": 72, + "line": 5, + }, + }, + "range": Array [ + 414, + 415, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 75, + "line": 5, + }, + "start": Object { + "column": 74, + "line": 5, + }, + }, + "range": Array [ + 416, + 417, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 5, + }, + "start": Object { + "column": 76, + "line": 5, + }, + }, + "range": Array [ + 418, + 419, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 83, + "line": 5, + }, + "start": Object { + "column": 78, + "line": 5, + }, + }, + "range": Array [ + 420, + 425, + ], + "type": "Identifier", + "value": "never", + }, + Object { + "loc": Object { + "end": Object { + "column": 84, + "line": 5, + }, + "start": Object { + "column": 83, + "line": 5, + }, + }, + "range": Array [ + 425, + 426, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer.src.ts.shot new file mode 100644 index 00000000000..d556be2bb33 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer.src.ts.shot @@ -0,0 +1,679 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types conditional-infer.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Element", + "optional": false, + "range": Array [ + 5, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "extendsType": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 36, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 35, + 36, + ], + "type": "TSTypeParameter", + }, + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 39, + ], + "type": "TSArrayType", + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 46, + 47, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 47, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "type": "TSConditionalType", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 13, + 14, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 12, + 15, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 12, + ], + "type": "Identifier", + "value": "Element", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 27, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 34, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/conditional-with-null.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-with-null.src.ts.shot new file mode 100644 index 00000000000..876c8a65b99 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-with-null.src.ts.shot @@ -0,0 +1,387 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types conditional-with-null.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 45, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, + ], + "type": "TSNumberKeyword", + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 45, + ], + "type": "TSNullKeyword", + }, + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 45, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "TSBooleanKeyword", + }, + "type": "TSConditionalType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 45, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 46, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 45, + ], + "type": "Keyword", + "value": "null", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/conditional.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/conditional.src.ts.shot new file mode 100644 index 00000000000..8f5bdbc813e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/conditional.src.ts.shot @@ -0,0 +1,387 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types conditional.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 47, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, + ], + "type": "TSNumberKeyword", + }, + "extendsType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSStringKeyword", + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 47, + ], + "type": "TSStringKeyword", + }, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 47, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "TSBooleanKeyword", + }, + "type": "TSConditionalType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 47, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 47, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-abstract.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-abstract.src.ts.shot new file mode 100644 index 00000000000..6f8cbb5fcba --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-abstract.src.ts.shot @@ -0,0 +1,338 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types constructor-abstract.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 30, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 30, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "abstract": true, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 7, + 30, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 30, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 30, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSConstructorType", + "typeParameters": undefined, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 30, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 15, + ], + "type": "Identifier", + "value": "abstract", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 30, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-empty.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-empty.src.ts.shot new file mode 100644 index 00000000000..b6b6fbdd8fd --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-empty.src.ts.shot @@ -0,0 +1,320 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types constructor-empty.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 21, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 21, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "abstract": false, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 7, + 21, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 21, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSConstructorType", + "typeParameters": undefined, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 21, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-generic.src.ts.shot new file mode 100644 index 00000000000..6315190137c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-generic.src.ts.shot @@ -0,0 +1,587 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types constructor-generic.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 4, + 25, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 25, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "abstract": false, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 15, + 19, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 7, + 25, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 25, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "type": "TSConstructorType", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 12, + 13, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 11, + 14, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 25, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 23, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-in-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-in-generic.src.ts.shot new file mode 100644 index 00000000000..3ef5ac52bce --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-in-generic.src.ts.shot @@ -0,0 +1,431 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types constructor-in-generic.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 30, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 30, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 30, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "Array", + "optional": false, + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "params": Array [ + Object { + "abstract": false, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 13, + 29, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 29, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "TSStringKeyword", + }, + }, + "type": "TSConstructorType", + "typeParameters": undefined, + }, + ], + "range": Array [ + 12, + 30, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 30, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + "value": "Array", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 16, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-with-rest.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-with-rest.src.ts.shot new file mode 100644 index 00000000000..9302a680a28 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-with-rest.src.ts.shot @@ -0,0 +1,521 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types constructor-with-rest.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 4, + 35, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 35, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "abstract": false, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 12, + 26, + ], + "type": "RestElement", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 26, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 24, + ], + "type": "TSNumberKeyword", + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 26, + ], + "type": "TSArrayType", + }, + }, + "value": undefined, + }, + ], + "range": Array [ + 7, + 35, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 35, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 35, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSConstructorType", + "typeParameters": undefined, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 35, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 24, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 30, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 35, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/constructor.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/constructor.src.ts.shot new file mode 100644 index 00000000000..baa59e3376a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/constructor.src.ts.shot @@ -0,0 +1,573 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types constructor.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 4, + 42, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "abstract": false, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 12, + 21, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 21, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 21, + ], + "type": "TSNumberKeyword", + }, + }, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "b", + "optional": true, + "range": Array [ + 23, + 33, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 33, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 7, + 42, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 42, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 42, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSConstructorType", + "typeParameters": undefined, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 42, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 43, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 10, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 21, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 37, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 42, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/function-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/function-generic.src.ts.shot new file mode 100644 index 00000000000..f02012c203f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/function-generic.src.ts.shot @@ -0,0 +1,568 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types function-generic.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 4, + 21, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 21, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 11, + 15, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 15, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 7, + 21, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "type": "TSFunctionType", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 8, + 9, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 7, + 10, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 21, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 19, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/function-in-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/function-in-generic.src.ts.shot new file mode 100644 index 00000000000..842b56c9950 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/function-in-generic.src.ts.shot @@ -0,0 +1,412 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types function-in-generic.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 24, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 24, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 24, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "Array", + "optional": false, + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 13, + 23, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSFunctionType", + "typeParameters": undefined, + }, + ], + "range": Array [ + 12, + 24, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 24, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 25, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + "value": "Array", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 18, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/function-with-array-destruction.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/function-with-array-destruction.src.ts.shot new file mode 100644 index 00000000000..f643c7622c5 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/function-with-array-destruction.src.ts.shot @@ -0,0 +1,413 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types function-with-array-destruction.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "elements": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 12, + 20, + ], + "type": "ArrayPattern", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 11, + 28, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSAnyKeyword", + }, + }, + "type": "TSFunctionType", + "typeParameters": undefined, + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "any", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/function-with-object-destruction.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/function-with-object-destruction.src.ts.shot new file mode 100644 index 00000000000..e15775eab01 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/function-with-object-destruction.src.ts.shot @@ -0,0 +1,456 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types function-with-object-destruction.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "optional": false, + "properties": Array [ + Object { + "computed": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "init", + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "method": false, + "optional": false, + "range": Array [ + 13, + 14, + ], + "shorthand": true, + "type": "Property", + "value": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + }, + ], + "range": Array [ + 12, + 20, + ], + "type": "ObjectPattern", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "TSAnyKeyword", + }, + }, + }, + ], + "range": Array [ + 11, + 28, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "TSAnyKeyword", + }, + }, + "type": "TSFunctionType", + "typeParameters": undefined, + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "any", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "any", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/function-with-rest.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/function-with-rest.src.ts.shot new file mode 100644 index 00000000000..b7b0cf57c2f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/function-with-rest.src.ts.shot @@ -0,0 +1,502 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types function-with-rest.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 4, + 31, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 31, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "argument": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 8, + 22, + ], + "type": "RestElement", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 22, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "TSNumberKeyword", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 22, + ], + "type": "TSArrayType", + }, + }, + "value": undefined, + }, + ], + "range": Array [ + 7, + 31, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 31, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 31, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSFunctionType", + "typeParameters": undefined, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 31, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 11, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 31, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/function-with-this.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/function-with-this.src.ts.shot new file mode 100644 index 00000000000..9d7b67352db --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/function-with-this.src.ts.shot @@ -0,0 +1,410 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types function-with-this.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 4, + 29, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 29, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "this", + "optional": false, + "range": Array [ + 8, + 20, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 20, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 7, + 29, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 29, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 29, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSFunctionType", + "typeParameters": undefined, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 29, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 12, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 29, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/function.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/function.src.ts.shot new file mode 100644 index 00000000000..fbb141e32dc --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/function.src.ts.shot @@ -0,0 +1,554 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types function.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "f", + "optional": false, + "range": Array [ + 4, + 38, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 8, + 17, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 17, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSNumberKeyword", + }, + }, + }, + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "b", + "optional": true, + "range": Array [ + 19, + 29, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 29, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 7, + 38, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 38, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSFunctionType", + "typeParameters": undefined, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 38, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "f", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 33, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 38, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/index-signature-readonly.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/index-signature-readonly.src.ts.shot new file mode 100644 index 00000000000..ce7d3c96f62 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/index-signature-readonly.src.ts.shot @@ -0,0 +1,449 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types index-signature-readonly.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "members": Array [ + Object { + "accessibility": undefined, + "export": false, + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "parameters": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "name": "key", + "optional": false, + "range": Array [ + 25, + 36, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 28, + 36, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 15, + 46, + ], + "readonly": true, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 37, + 45, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 39, + 45, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 11, + 48, + ], + "type": "TSTypeLiteral", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 15, + 23, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 25, + 28, + ], + "type": "Identifier", + "value": "key", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 17, + "line": 2, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 39, + 45, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/index-signature-without-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/index-signature-without-type.src.ts.shot new file mode 100644 index 00000000000..2cc1ba964e9 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/index-signature-without-type.src.ts.shot @@ -0,0 +1,362 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types index-signature-without-type.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "members": Array [ + Object { + "accessibility": undefined, + "export": false, + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "parameters": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 16, + 25, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 25, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 15, + 27, + ], + "readonly": false, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": undefined, + }, + ], + "range": Array [ + 11, + 29, + ], + "type": "TSTypeLiteral", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 30, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/index-signature.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/index-signature.src.ts.shot new file mode 100644 index 00000000000..59bc2f21368 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/index-signature.src.ts.shot @@ -0,0 +1,431 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types index-signature.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "members": Array [ + Object { + "accessibility": undefined, + "export": false, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "parameters": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 16, + 25, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 25, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 15, + 35, + ], + "readonly": false, + "static": false, + "type": "TSIndexSignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 26, + 34, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 28, + 34, + ], + "type": "TSStringKeyword", + }, + }, + }, + ], + "range": Array [ + 11, + 37, + ], + "type": "TSTypeLiteral", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 28, + 34, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/indexed.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/indexed.src.ts.shot new file mode 100644 index 00000000000..703c2baac08 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/indexed.src.ts.shot @@ -0,0 +1,343 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types indexed.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 11, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "indexType": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "name": "K", + "optional": false, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "objectType": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "range": Array [ + 7, + 11, + ], + "type": "TSIndexedAccessType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 11, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 12, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Identifier", + "value": "K", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/interface-with-accessors.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/interface-with-accessors.src.ts.shot new file mode 100644 index 00000000000..0b85e594dad --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/interface-with-accessors.src.ts.shot @@ -0,0 +1,738 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types interface-with-accessors.src 1`] = ` +Object { + "body": Array [ + Object { + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "size", + "optional": false, + "range": Array [ + 24, + 28, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "params": Array [], + "range": Array [ + 20, + 39, + ], + "readonly": false, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 30, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "TSNumberKeyword", + }, + }, + "static": false, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "size", + "optional": false, + "range": Array [ + 46, + 50, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "name": "value", + "optional": false, + "range": Array [ + 51, + 83, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 56, + 83, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 58, + 83, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "TSNumberKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 67, + 73, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 76, + 83, + ], + "type": "TSBooleanKeyword", + }, + ], + }, + }, + }, + ], + "range": Array [ + 42, + 85, + ], + "readonly": false, + "returnType": undefined, + "static": false, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 87, + ], + "type": "TSInterfaceBody", + }, + "declare": false, + "extends": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "Thing", + "optional": false, + "range": Array [ + 10, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 87, + ], + "type": "TSInterfaceDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 88, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "Keyword", + "value": "interface", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 15, + ], + "type": "Identifier", + "value": "Thing", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 20, + 23, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 24, + 28, + ], + "type": "Identifier", + "value": "size", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 42, + 45, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 46, + 50, + ], + "type": "Identifier", + "value": "size", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 51, + 56, + ], + "type": "Identifier", + "value": "value", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 58, + 64, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 65, + 66, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 67, + 73, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 3, + }, + "start": Object { + "column": 34, + "line": 3, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 76, + 83, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 3, + }, + "start": Object { + "column": 43, + "line": 3, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 44, + "line": 3, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/intersection-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/intersection-type.src.ts.shot new file mode 100644 index 00000000000..904a7453e7f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/intersection-type.src.ts.shot @@ -0,0 +1,668 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types intersection-type.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "LinkedList", + "optional": false, + "range": Array [ + 5, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 49, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 48, + ], + "type": "TSIntersectionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "members": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "name": "next", + "optional": false, + "range": Array [ + 27, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 27, + 46, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 46, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 46, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "name": "LinkedList", + "optional": false, + "range": Array [ + 33, + 43, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 43, + 46, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + }, + ], + "range": Array [ + 25, + 48, + ], + "type": "TSTypeLiteral", + }, + ], + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 16, + 17, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 15, + 18, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 15, + ], + "type": "Identifier", + "value": "LinkedList", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "&", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 31, + ], + "type": "Identifier", + "value": "next", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 43, + ], + "type": "Identifier", + "value": "LinkedList", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 1, + }, + "start": Object { + "column": 48, + "line": 1, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/literal-number-negative.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/literal-number-negative.src.ts.shot new file mode 100644 index 00000000000..3480afeff7e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/literal-number-negative.src.ts.shot @@ -0,0 +1,267 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types literal-number-negative.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 9, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 9, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "literal": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "raw": "1", + "type": "Literal", + "value": 1, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "operator": "-", + "prefix": true, + "range": Array [ + 7, + 9, + ], + "type": "UnaryExpression", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "TSLiteralType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 9, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "-", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Numeric", + "value": "1", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/literal-number.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/literal-number.src.ts.shot new file mode 100644 index 00000000000..204be090cbd --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/literal-number.src.ts.shot @@ -0,0 +1,230 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types literal-number.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 8, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "raw": "0", + "type": "Literal", + "value": 0, + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "TSLiteralType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 8, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Numeric", + "value": "0", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/literal-string.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/literal-string.src.ts.shot new file mode 100644 index 00000000000..863e84993a8 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/literal-string.src.ts.shot @@ -0,0 +1,230 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types literal-string.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 12, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 12, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "raw": "\\"foo\\"", + "type": "Literal", + "value": "foo", + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "TSLiteralType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 12, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 13, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 14, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "String", + "value": "\\"foo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/mapped-named-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/mapped-named-type.src.ts.shot new file mode 100644 index 00000000000..4d666f1164b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/mapped-named-type.src.ts.shot @@ -0,0 +1,789 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types mapped-named-type.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Test", + "optional": false, + "range": Array [ + 5, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 50, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "nameType": Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 36, + 39, + ], + "raw": "'a'", + "type": "Literal", + "value": "a", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 36, + 39, + ], + "type": "TSLiteralType", + }, + "optional": undefined, + "range": Array [ + 15, + 49, + ], + "readonly": undefined, + "type": "TSMappedType", + "typeAnnotation": Object { + "indexType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "name": "P", + "optional": false, + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "objectType": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + "range": Array [ + 42, + 46, + ], + "type": "TSIndexedAccessType", + }, + "typeParameter": Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "operator": "keyof", + "range": Array [ + 25, + 32, + ], + "type": "TSTypeOperator", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "name": "P", + "optional": false, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 20, + 32, + ], + "type": "TSTypeParameter", + }, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 10, + 11, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 9, + 12, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 51, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 9, + ], + "type": "Identifier", + "value": "Test", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 3, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "P", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 22, + 24, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 25, + 30, + ], + "type": "Identifier", + "value": "keyof", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 33, + 35, + ], + "type": "Identifier", + "value": "as", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 19, + "line": 2, + }, + }, + "range": Array [ + 36, + 39, + ], + "type": "String", + "value": "'a'", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 2, + }, + "start": Object { + "column": 26, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Identifier", + "value": "P", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 28, + "line": 2, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/mapped-readonly-minus.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/mapped-readonly-minus.src.ts.shot new file mode 100644 index 00000000000..5c8253cce0f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/mapped-readonly-minus.src.ts.shot @@ -0,0 +1,505 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types mapped-readonly-minus.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "map", + "optional": false, + "range": Array [ + 4, + 46, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 46, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "nameType": null, + "optional": "-", + "range": Array [ + 9, + 46, + ], + "readonly": "-", + "type": "TSMappedType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "TSNumberKeyword", + }, + "typeParameter": Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "TSStringKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "P", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 22, + 33, + ], + "type": "TSTypeParameter", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 46, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "map", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "-", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 20, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "P", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "-", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/mapped-readonly-plus.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/mapped-readonly-plus.src.ts.shot new file mode 100644 index 00000000000..e0a3f82a0f6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/mapped-readonly-plus.src.ts.shot @@ -0,0 +1,523 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types mapped-readonly-plus.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "map", + "optional": false, + "range": Array [ + 4, + 47, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 47, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "nameType": null, + "optional": "+", + "range": Array [ + 9, + 47, + ], + "readonly": "+", + "type": "TSMappedType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "TSNumberKeyword", + }, + "typeParameter": Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "TSStringKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "P", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 22, + 33, + ], + "type": "TSTypeParameter", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 47, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 48, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "map", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 20, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "P", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 26, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "+", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/mapped-readonly.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/mapped-readonly.src.ts.shot new file mode 100644 index 00000000000..e40f0c70620 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/mapped-readonly.src.ts.shot @@ -0,0 +1,487 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types mapped-readonly.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "map", + "optional": false, + "range": Array [ + 4, + 45, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 45, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "nameType": null, + "optional": true, + "range": Array [ + 9, + 45, + ], + "readonly": true, + "type": "TSMappedType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "TSNumberKeyword", + }, + "typeParameter": Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "TSStringKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "name": "P", + "optional": false, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 21, + 32, + ], + "type": "TSTypeParameter", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 45, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 46, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 47, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "map", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 19, + ], + "type": "Identifier", + "value": "readonly", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "P", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 25, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 46, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/mapped-untypped.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/mapped-untypped.src.ts.shot new file mode 100644 index 00000000000..b1d3f6463b6 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/mapped-untypped.src.ts.shot @@ -0,0 +1,399 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types mapped-untypped.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "map", + "optional": false, + "range": Array [ + 4, + 27, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 27, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "nameType": null, + "optional": undefined, + "range": Array [ + 9, + 27, + ], + "readonly": undefined, + "type": "TSMappedType", + "typeAnnotation": undefined, + "typeParameter": Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 23, + ], + "type": "TSStringKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "P", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 12, + 23, + ], + "type": "TSTypeParameter", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 27, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "map", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "P", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 23, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/mapped.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/mapped.src.ts.shot new file mode 100644 index 00000000000..8b69a493792 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/mapped.src.ts.shot @@ -0,0 +1,451 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types mapped.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "map", + "optional": false, + "range": Array [ + 4, + 35, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 35, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "nameType": null, + "optional": undefined, + "range": Array [ + 9, + 35, + ], + "readonly": undefined, + "type": "TSMappedType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "TSNumberKeyword", + }, + "typeParameter": Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 23, + ], + "type": "TSStringKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "P", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 12, + 23, + ], + "type": "TSTypeParameter", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 35, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 36, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "map", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "P", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 23, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/nested-types.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/nested-types.src.ts.shot new file mode 100644 index 00000000000..bc759904969 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/nested-types.src.ts.shot @@ -0,0 +1,964 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types nested-types.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 80, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 80, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "elementTypes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 18, + ], + "type": "TSNumberKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 27, + ], + "type": "TSOptionalType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 26, + ], + "type": "TSStringKeyword", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 37, + ], + "type": "TSOptionalType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 36, + ], + "type": "TSBooleanKeyword", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 38, + ], + "type": "TSTupleType", + }, + Object { + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 80, + ], + "type": "TSIntersectionType", + "types": Array [ + Object { + "elementTypes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "members": Array [], + "range": Array [ + 42, + 44, + ], + "type": "TSTypeLiteral", + }, + Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 74, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "elementTypes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 54, + ], + "type": "TSOptionalType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 53, + ], + "type": "TSNumberKeyword", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 55, + ], + "type": "TSTupleType", + }, + Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 1, + }, + "start": Object { + "column": 58, + "line": 1, + }, + }, + "range": Array [ + 58, + 74, + ], + "type": "TSIntersectionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 62, + "line": 1, + }, + "start": Object { + "column": 58, + "line": 1, + }, + }, + "range": Array [ + 58, + 62, + ], + "type": "TSNullKeyword", + }, + Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 72, + "line": 1, + }, + "start": Object { + "column": 65, + "line": 1, + }, + }, + "range": Array [ + 65, + 72, + ], + "type": "TSBooleanKeyword", + }, + "loc": Object { + "end": Object { + "column": 74, + "line": 1, + }, + "start": Object { + "column": 65, + "line": 1, + }, + }, + "range": Array [ + 65, + 74, + ], + "type": "TSArrayType", + }, + ], + }, + ], + }, + ], + "loc": Object { + "end": Object { + "column": 75, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 75, + ], + "type": "TSTupleType", + }, + Object { + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 78, + "line": 1, + }, + }, + "members": Array [], + "range": Array [ + 78, + 80, + ], + "type": "TSTypeLiteral", + }, + ], + }, + ], + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 81, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 18, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 26, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 36, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 47, + "line": 1, + }, + }, + "range": Array [ + 47, + 53, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 54, + "line": 1, + }, + "start": Object { + "column": 53, + "line": 1, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 1, + }, + "start": Object { + "column": 54, + "line": 1, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 57, + "line": 1, + }, + "start": Object { + "column": 56, + "line": 1, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 62, + "line": 1, + }, + "start": Object { + "column": 58, + "line": 1, + }, + }, + "range": Array [ + 58, + 62, + ], + "type": "Keyword", + "value": "null", + }, + Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 63, + "line": 1, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": "&", + }, + Object { + "loc": Object { + "end": Object { + "column": 72, + "line": 1, + }, + "start": Object { + "column": 65, + "line": 1, + }, + }, + "range": Array [ + 65, + 72, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 1, + }, + "start": Object { + "column": 72, + "line": 1, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 1, + }, + "start": Object { + "column": 73, + "line": 1, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 75, + "line": 1, + }, + "start": Object { + "column": 74, + "line": 1, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 76, + "line": 1, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "&", + }, + Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 1, + }, + "start": Object { + "column": 78, + "line": 1, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 80, + "line": 1, + }, + "start": Object { + "column": 79, + "line": 1, + }, + }, + "range": Array [ + 79, + 80, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/object-literal-type-with-accessors.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/object-literal-type-with-accessors.src.ts.shot new file mode 100644 index 00000000000..d1c75c15bc1 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/object-literal-type-with-accessors.src.ts.shot @@ -0,0 +1,773 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types object-literal-type-with-accessors.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Thing", + "optional": false, + "range": Array [ + 5, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 85, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "members": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "name": "size", + "optional": false, + "range": Array [ + 21, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "get", + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "params": Array [], + "range": Array [ + 17, + 36, + ], + "readonly": false, + "returnType": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 27, + 35, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "TSNumberKeyword", + }, + }, + "static": false, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "name": "size", + "optional": false, + "range": Array [ + 43, + 47, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "set", + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "optional": false, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "name": "value", + "optional": false, + "range": Array [ + 48, + 80, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 53, + 80, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 55, + 80, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 55, + 61, + ], + "type": "TSNumberKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 64, + 70, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 73, + 80, + ], + "type": "TSBooleanKeyword", + }, + ], + }, + }, + }, + ], + "range": Array [ + 39, + 82, + ], + "readonly": false, + "returnType": undefined, + "static": false, + "type": "TSMethodSignature", + "typeParameters": undefined, + }, + ], + "range": Array [ + 13, + 84, + ], + "type": "TSTypeLiteral", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 86, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "Identifier", + "value": "Thing", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 17, + 20, + ], + "type": "Identifier", + "value": "get", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 6, + "line": 2, + }, + }, + "range": Array [ + 21, + 25, + ], + "type": "Identifier", + "value": "size", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 29, + 35, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 39, + 42, + ], + "type": "Identifier", + "value": "set", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 43, + 47, + ], + "type": "Identifier", + "value": "size", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 3, + }, + "start": Object { + "column": 10, + "line": 3, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 48, + 53, + ], + "type": "Identifier", + "value": "value", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 3, + }, + "start": Object { + "column": 16, + "line": 3, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 18, + "line": 3, + }, + }, + "range": Array [ + 55, + 61, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 3, + }, + "start": Object { + "column": 25, + "line": 3, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 3, + }, + "start": Object { + "column": 27, + "line": 3, + }, + }, + "range": Array [ + 64, + 70, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 3, + }, + "start": Object { + "column": 34, + "line": 3, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 73, + 80, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 3, + }, + "start": Object { + "column": 43, + "line": 3, + }, + }, + "range": Array [ + 80, + 81, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 3, + }, + "start": Object { + "column": 44, + "line": 3, + }, + }, + "range": Array [ + 81, + 82, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-in-and-out.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-in-and-out.src.ts.shot new file mode 100644 index 00000000000..c920673605a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-in-and-out.src.ts.shot @@ -0,0 +1,645 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types optional-variance-in-and-out.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Mapper", + "optional": false, + "range": Array [ + 5, + 11, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 28, + 32, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 27, + 38, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "type": "TSFunctionType", + "typeParameters": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": true, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 12, + 16, + ], + "type": "TSTypeParameter", + }, + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "U", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": true, + "range": Array [ + 18, + 23, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 11, + 24, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "type": "Identifier", + "value": "Mapper", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + "value": "out", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 36, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-in-out.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-in-out.src.ts.shot new file mode 100644 index 00000000000..7b510af7227 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-in-out.src.ts.shot @@ -0,0 +1,567 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types optional-variance-in-out.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Processor", + "optional": false, + "range": Array [ + 5, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 28, + 32, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 27, + 38, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "type": "TSFunctionType", + "typeParameters": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": true, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": true, + "range": Array [ + 15, + 23, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 14, + 24, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 14, + ], + "type": "Identifier", + "value": "Processor", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 17, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + "value": "out", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 36, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-in.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-in.src.ts.shot new file mode 100644 index 00000000000..13960d9cfa4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-in.src.ts.shot @@ -0,0 +1,527 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types optional-variance-in.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Consumer", + "optional": false, + "range": Array [ + 5, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 23, + 27, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 22, + 36, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 36, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 36, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSFunctionType", + "typeParameters": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": true, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 14, + 18, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 13, + 19, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 13, + ], + "type": "Identifier", + "value": "Consumer", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 36, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-out.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-out.src.ts.shot new file mode 100644 index 00000000000..5bbd49f347f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-out.src.ts.shot @@ -0,0 +1,418 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types optional-variance-out.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Provider", + "optional": false, + "range": Array [ + 5, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 23, + 30, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 30, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + "type": "TSFunctionType", + "typeParameters": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": true, + "range": Array [ + 14, + 19, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 13, + 20, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 13, + ], + "type": "Identifier", + "value": "Provider", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "out", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/parenthesized-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/parenthesized-type.src.ts.shot new file mode 100644 index 00000000000..a46af1bf983 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/parenthesized-type.src.ts.shot @@ -0,0 +1,264 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types parenthesized-type.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 27, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 18, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "TSNumberKeyword", + }, + ], + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 18, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/reference-generic-nested.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/reference-generic-nested.src.ts.shot new file mode 100644 index 00000000000..49cd9577c3a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/reference-generic-nested.src.ts.shot @@ -0,0 +1,433 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types reference-generic-nested.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 27, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 27, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 27, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "Array", + "optional": false, + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 26, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "Array", + "optional": false, + "range": Array [ + 13, + 18, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 18, + 26, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + ], + "range": Array [ + 12, + 27, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 27, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + "value": "Array", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 18, + ], + "type": "Identifier", + "value": "Array", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/reference-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/reference-generic.src.ts.shot new file mode 100644 index 00000000000..a005225eba2 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/reference-generic.src.ts.shot @@ -0,0 +1,322 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types reference-generic.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 20, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 20, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 20, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "Array", + "optional": false, + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 19, + ], + "type": "TSNumberKeyword", + }, + ], + "range": Array [ + 12, + 20, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 20, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + "value": "Array", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 19, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/reference.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/reference.src.ts.shot new file mode 100644 index 00000000000..ce1d4841241 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/reference.src.ts.shot @@ -0,0 +1,233 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types reference.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 8, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 8, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 9, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-1.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-1.src.ts.shot new file mode 100644 index 00000000000..cca9f93240b --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-1.src.ts.shot @@ -0,0 +1,216 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types template-literal-type-1.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "literal": Object { + "expressions": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "foo", + "raw": "foo", + }, + }, + ], + "range": Array [ + 9, + 14, + ], + "type": "TemplateLiteral", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "TSLiteralType", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 16, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 14, + ], + "type": "Template", + "value": "\`foo\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-2.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-2.src.ts.shot new file mode 100644 index 00000000000..0988b939ff3 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-2.src.ts.shot @@ -0,0 +1,294 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types template-literal-type-2.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": "foo", + "raw": "foo", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "", + "raw": "", + }, + }, + ], + "range": Array [ + 9, + 22, + ], + "type": "TSTemplateLiteralType", + "types": Array [ + Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "raw": "'bar'", + "type": "Literal", + "value": "bar", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "TSLiteralType", + }, + ], + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 15, + ], + "type": "Template", + "value": "\`foo\${", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 20, + ], + "type": "String", + "value": "'bar'", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 22, + ], + "type": "Template", + "value": "}\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-3.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-3.src.ts.shot new file mode 100644 index 00000000000..f1600354bd4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-3.src.ts.shot @@ -0,0 +1,905 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types template-literal-type-3.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Color", + "optional": false, + "range": Array [ + 5, + 10, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 27, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 18, + ], + "raw": "\\"red\\"", + "type": "Literal", + "value": "red", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 18, + ], + "type": "TSLiteralType", + }, + Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "raw": "\\"blue\\"", + "type": "Literal", + "value": "blue", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "TSLiteralType", + }, + ], + }, + "typeParameters": undefined, + }, + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "Quantity", + "optional": false, + "range": Array [ + 34, + 42, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 29, + 59, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 45, + 58, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 45, + 50, + ], + "raw": "\\"one\\"", + "type": "Literal", + "value": "one", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 45, + 50, + ], + "type": "TSLiteralType", + }, + Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 53, + 58, + ], + "raw": "\\"two\\"", + "type": "Literal", + "value": "two", + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 53, + 58, + ], + "type": "TSLiteralType", + }, + ], + }, + "typeParameters": undefined, + }, + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "SeussFish", + "optional": false, + "range": Array [ + 65, + 74, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 44, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 60, + 104, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 77, + 80, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": "", + "raw": "", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 96, + 103, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": " fish", + "raw": " fish", + }, + }, + ], + "range": Array [ + 77, + 103, + ], + "type": "TSTemplateLiteralType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 80, + 96, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 80, + 88, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "name": "Quantity", + "optional": false, + "range": Array [ + 80, + 88, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 31, + "line": 3, + }, + }, + "range": Array [ + 91, + 96, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 31, + "line": 3, + }, + }, + "name": "Color", + "optional": false, + "range": Array [ + 91, + 96, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + }, + ], + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 105, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 10, + ], + "type": "Identifier", + "value": "Color", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 18, + ], + "type": "String", + "value": "\\"red\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 27, + ], + "type": "String", + "value": "\\"blue\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 29, + 33, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 34, + 42, + ], + "type": "Identifier", + "value": "Quantity", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 45, + 50, + ], + "type": "String", + "value": "\\"one\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 2, + }, + "start": Object { + "column": 22, + "line": 2, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 53, + 58, + ], + "type": "String", + "value": "\\"two\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 2, + }, + "start": Object { + "column": 29, + "line": 2, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 60, + 64, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 65, + 74, + ], + "type": "Identifier", + "value": "SeussFish", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 77, + 80, + ], + "type": "Template", + "value": "\`\${", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 3, + }, + "start": Object { + "column": 20, + "line": 3, + }, + }, + "range": Array [ + 80, + 88, + ], + "type": "Identifier", + "value": "Quantity", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 3, + }, + "start": Object { + "column": 29, + "line": 3, + }, + }, + "range": Array [ + 89, + 90, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 3, + }, + "start": Object { + "column": 31, + "line": 3, + }, + }, + "range": Array [ + 91, + 96, + ], + "type": "Identifier", + "value": "Color", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 36, + "line": 3, + }, + }, + "range": Array [ + 96, + 103, + ], + "type": "Template", + "value": "} fish\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 3, + }, + "start": Object { + "column": 43, + "line": 3, + }, + }, + "range": Array [ + 103, + 104, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-4.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-4.src.ts.shot new file mode 100644 index 00000000000..1a71387ccff --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-4.src.ts.shot @@ -0,0 +1,1475 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types template-literal-type-4.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "EnthusiasticGreeting", + "optional": false, + "range": Array [ + 5, + 25, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 122, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 122, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 121, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "quasis": Array [ + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 49, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": "", + "raw": "", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 67, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "range": Array [ + 61, + 67, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": " - ", + "raw": " - ", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 85, + "line": 1, + }, + "start": Object { + "column": 79, + "line": 1, + }, + }, + "range": Array [ + 79, + 85, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": " - ", + "raw": " - ", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 104, + "line": 1, + }, + "start": Object { + "column": 98, + "line": 1, + }, + }, + "range": Array [ + 98, + 104, + ], + "tail": false, + "type": "TemplateElement", + "value": Object { + "cooked": " - ", + "raw": " - ", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 121, + "line": 1, + }, + "start": Object { + "column": 119, + "line": 1, + }, + }, + "range": Array [ + 119, + 121, + ], + "tail": true, + "type": "TemplateElement", + "value": Object { + "cooked": "", + "raw": "", + }, + }, + ], + "range": Array [ + 46, + 121, + ], + "type": "TSTemplateLiteralType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 61, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 58, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "name": "Uppercase", + "optional": false, + "range": Array [ + 49, + 58, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 1, + }, + "start": Object { + "column": 58, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 60, + "line": 1, + }, + "start": Object { + "column": 59, + "line": 1, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 60, + "line": 1, + }, + "start": Object { + "column": 59, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 58, + 61, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 1, + }, + "start": Object { + "column": 67, + "line": 1, + }, + }, + "range": Array [ + 67, + 79, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 76, + "line": 1, + }, + "start": Object { + "column": 67, + "line": 1, + }, + }, + "name": "Lowercase", + "optional": false, + "range": Array [ + 67, + 76, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 1, + }, + "start": Object { + "column": 76, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 78, + "line": 1, + }, + "start": Object { + "column": 77, + "line": 1, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 78, + "line": 1, + }, + "start": Object { + "column": 77, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 77, + 78, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 76, + 79, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 98, + "line": 1, + }, + "start": Object { + "column": 85, + "line": 1, + }, + }, + "range": Array [ + 85, + 98, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 95, + "line": 1, + }, + "start": Object { + "column": 85, + "line": 1, + }, + }, + "name": "Capitalize", + "optional": false, + "range": Array [ + 85, + 95, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 98, + "line": 1, + }, + "start": Object { + "column": 95, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 97, + "line": 1, + }, + "start": Object { + "column": 96, + "line": 1, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 97, + "line": 1, + }, + "start": Object { + "column": 96, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 96, + 97, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 95, + 98, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 119, + "line": 1, + }, + "start": Object { + "column": 104, + "line": 1, + }, + }, + "range": Array [ + 104, + 119, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 116, + "line": 1, + }, + "start": Object { + "column": 104, + "line": 1, + }, + }, + "name": "Uncapitalize", + "optional": false, + "range": Array [ + 104, + 116, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 119, + "line": 1, + }, + "start": Object { + "column": 116, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 118, + "line": 1, + }, + "start": Object { + "column": 117, + "line": 1, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 118, + "line": 1, + }, + "start": Object { + "column": 117, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 117, + 118, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 116, + 119, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + ], + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "TSStringKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "out": false, + "range": Array [ + 26, + 42, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 25, + 43, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "HELLO", + "optional": false, + "range": Array [ + 128, + 133, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 123, + 166, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 136, + 165, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "EnthusiasticGreeting", + "optional": false, + "range": Array [ + 136, + 156, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "params": Array [ + Object { + "literal": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 157, + 164, + ], + "raw": "\\"heLLo\\"", + "type": "Literal", + "value": "heLLo", + }, + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 157, + 164, + ], + "type": "TSLiteralType", + }, + ], + "range": Array [ + 156, + 165, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 167, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 25, + ], + "type": "Identifier", + "value": "EnthusiasticGreeting", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 35, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 45, + "line": 1, + }, + "start": Object { + "column": 44, + "line": 1, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 49, + ], + "type": "Template", + "value": "\`\${", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 1, + }, + "start": Object { + "column": 49, + "line": 1, + }, + }, + "range": Array [ + 49, + 58, + ], + "type": "Identifier", + "value": "Uppercase", + }, + Object { + "loc": Object { + "end": Object { + "column": 59, + "line": 1, + }, + "start": Object { + "column": 58, + "line": 1, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 60, + "line": 1, + }, + "start": Object { + "column": 59, + "line": 1, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 61, + "line": 1, + }, + "start": Object { + "column": 60, + "line": 1, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 67, + "line": 1, + }, + "start": Object { + "column": 61, + "line": 1, + }, + }, + "range": Array [ + 61, + 67, + ], + "type": "Template", + "value": "} - \${", + }, + Object { + "loc": Object { + "end": Object { + "column": 76, + "line": 1, + }, + "start": Object { + "column": 67, + "line": 1, + }, + }, + "range": Array [ + 67, + 76, + ], + "type": "Identifier", + "value": "Lowercase", + }, + Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 1, + }, + "start": Object { + "column": 76, + "line": 1, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 78, + "line": 1, + }, + "start": Object { + "column": 77, + "line": 1, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 79, + "line": 1, + }, + "start": Object { + "column": 78, + "line": 1, + }, + }, + "range": Array [ + 78, + 79, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 85, + "line": 1, + }, + "start": Object { + "column": 79, + "line": 1, + }, + }, + "range": Array [ + 79, + 85, + ], + "type": "Template", + "value": "} - \${", + }, + Object { + "loc": Object { + "end": Object { + "column": 95, + "line": 1, + }, + "start": Object { + "column": 85, + "line": 1, + }, + }, + "range": Array [ + 85, + 95, + ], + "type": "Identifier", + "value": "Capitalize", + }, + Object { + "loc": Object { + "end": Object { + "column": 96, + "line": 1, + }, + "start": Object { + "column": 95, + "line": 1, + }, + }, + "range": Array [ + 95, + 96, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 97, + "line": 1, + }, + "start": Object { + "column": 96, + "line": 1, + }, + }, + "range": Array [ + 96, + 97, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 98, + "line": 1, + }, + "start": Object { + "column": 97, + "line": 1, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 104, + "line": 1, + }, + "start": Object { + "column": 98, + "line": 1, + }, + }, + "range": Array [ + 98, + 104, + ], + "type": "Template", + "value": "} - \${", + }, + Object { + "loc": Object { + "end": Object { + "column": 116, + "line": 1, + }, + "start": Object { + "column": 104, + "line": 1, + }, + }, + "range": Array [ + 104, + 116, + ], + "type": "Identifier", + "value": "Uncapitalize", + }, + Object { + "loc": Object { + "end": Object { + "column": 117, + "line": 1, + }, + "start": Object { + "column": 116, + "line": 1, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 118, + "line": 1, + }, + "start": Object { + "column": 117, + "line": 1, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 119, + "line": 1, + }, + "start": Object { + "column": 118, + "line": 1, + }, + }, + "range": Array [ + 118, + 119, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 121, + "line": 1, + }, + "start": Object { + "column": 119, + "line": 1, + }, + }, + "range": Array [ + 119, + 121, + ], + "type": "Template", + "value": "}\`", + }, + Object { + "loc": Object { + "end": Object { + "column": 122, + "line": 1, + }, + "start": Object { + "column": 121, + "line": 1, + }, + }, + "range": Array [ + 121, + 122, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 123, + 127, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 128, + 133, + ], + "type": "Identifier", + "value": "HELLO", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 134, + 135, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 136, + 156, + ], + "type": "Identifier", + "value": "EnthusiasticGreeting", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 156, + 157, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 2, + }, + "start": Object { + "column": 34, + "line": 2, + }, + }, + "range": Array [ + 157, + 164, + ], + "type": "String", + "value": "\\"heLLo\\"", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 2, + }, + "start": Object { + "column": 41, + "line": 2, + }, + }, + "range": Array [ + 164, + 165, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 2, + }, + "start": Object { + "column": 42, + "line": 2, + }, + }, + "range": Array [ + 165, + 166, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/this-type-expanded.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/this-type-expanded.src.ts.shot new file mode 100644 index 00000000000..bb1c7246b8d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/this-type-expanded.src.ts.shot @@ -0,0 +1,4234 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types this-type-expanded.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": "public", + "computed": false, + "declare": false, + "decorators": Array [], + "definite": false, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 12, + 29, + ], + "readonly": false, + "static": false, + "type": "PropertyDefinition", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSNumberKeyword", + }, + }, + "value": null, + }, + Object { + "accessibility": "public", + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "name": "method", + "optional": false, + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 33, + 91, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 80, + 84, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 85, + 86, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 80, + 86, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 73, + 87, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 36, + "line": 4, + }, + }, + "range": Array [ + 67, + 91, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "name": "this", + "optional": false, + "range": Array [ + 47, + 57, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 20, + "line": 4, + }, + }, + "range": Array [ + 51, + 57, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 4, + }, + }, + "range": Array [ + 53, + 57, + ], + "type": "TSThisType", + }, + }, + }, + ], + "range": Array [ + 46, + 91, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 58, + 66, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 4, + }, + "start": Object { + "column": 29, + "line": 4, + }, + }, + "range": Array [ + 60, + 66, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": "public", + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "name": "method2", + "optional": false, + "range": Array [ + 102, + 109, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 95, + 149, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 9, + }, + "start": Object { + "column": 11, + "line": 9, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 9, + }, + "start": Object { + "column": 11, + "line": 9, + }, + }, + "range": Array [ + 138, + 142, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 9, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 143, + 144, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 138, + 144, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 131, + 145, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 32, + "line": 8, + }, + }, + "range": Array [ + 125, + 149, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 16, + "line": 8, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 8, + }, + "start": Object { + "column": 17, + "line": 8, + }, + }, + "name": "this", + "optional": false, + "range": Array [ + 110, + 117, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 8, + }, + "start": Object { + "column": 21, + "line": 8, + }, + }, + "range": Array [ + 114, + 117, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 8, + }, + "start": Object { + "column": 23, + "line": 8, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 8, + }, + "start": Object { + "column": 23, + "line": 8, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 116, + 117, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 109, + 149, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 8, + }, + "start": Object { + "column": 25, + "line": 8, + }, + }, + "range": Array [ + 118, + 124, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 8, + }, + "start": Object { + "column": 27, + "line": 8, + }, + }, + "range": Array [ + 120, + 124, + ], + "type": "TSThisType", + }, + }, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": "public", + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 12, + }, + "start": Object { + "column": 9, + "line": 12, + }, + }, + "name": "method3", + "optional": false, + "range": Array [ + 160, + 167, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 15, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 153, + 237, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 13, + }, + "start": Object { + "column": 8, + "line": 13, + }, + }, + "name": "fn", + "optional": false, + "range": Array [ + 198, + 200, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 25, + "line": 13, + }, + "start": Object { + "column": 19, + "line": 13, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 13, + }, + "start": Object { + "column": 19, + "line": 13, + }, + }, + "range": Array [ + 209, + 213, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 13, + }, + "start": Object { + "column": 24, + "line": 13, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 214, + 215, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 209, + 215, + ], + "type": "MemberExpression", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 13, + }, + "start": Object { + "column": 13, + "line": 13, + }, + }, + "params": Array [], + "range": Array [ + 203, + 215, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 13, + }, + "start": Object { + "column": 8, + "line": 13, + }, + }, + "range": Array [ + 198, + 215, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 26, + "line": 13, + }, + "start": Object { + "column": 4, + "line": 13, + }, + }, + "range": Array [ + 194, + 216, + ], + "type": "VariableDeclaration", + }, + Object { + "argument": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 14, + }, + "start": Object { + "column": 11, + "line": 14, + }, + }, + "name": "fn", + "optional": false, + "range": Array [ + 228, + 230, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 14, + }, + "start": Object { + "column": 11, + "line": 14, + }, + }, + "optional": false, + "range": Array [ + 228, + 232, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "range": Array [ + 221, + 233, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 15, + }, + "start": Object { + "column": 37, + "line": 12, + }, + }, + "range": Array [ + 188, + 237, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 15, + }, + "start": Object { + "column": 16, + "line": 12, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 27, + "line": 12, + }, + "start": Object { + "column": 17, + "line": 12, + }, + }, + "name": "this", + "optional": false, + "range": Array [ + 168, + 178, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 12, + }, + "start": Object { + "column": 21, + "line": 12, + }, + }, + "range": Array [ + 172, + 178, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 12, + }, + "start": Object { + "column": 23, + "line": 12, + }, + }, + "range": Array [ + 174, + 178, + ], + "type": "TSThisType", + }, + }, + }, + ], + "range": Array [ + 167, + 237, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 12, + }, + "start": Object { + "column": 28, + "line": 12, + }, + }, + "range": Array [ + 179, + 187, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 12, + }, + "start": Object { + "column": 30, + "line": 12, + }, + }, + "range": Array [ + 181, + 187, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": "public", + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 16, + "line": 17, + }, + "start": Object { + "column": 9, + "line": 17, + }, + }, + "name": "method4", + "optional": false, + "range": Array [ + 248, + 255, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 20, + }, + "start": Object { + "column": 2, + "line": 17, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 241, + 322, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 10, + "line": 18, + }, + "start": Object { + "column": 8, + "line": 18, + }, + }, + "name": "fn", + "optional": false, + "range": Array [ + 283, + 285, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "init": Object { + "async": false, + "body": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 25, + "line": 18, + }, + "start": Object { + "column": 19, + "line": 18, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 18, + }, + "start": Object { + "column": 19, + "line": 18, + }, + }, + "range": Array [ + 294, + 298, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 25, + "line": 18, + }, + "start": Object { + "column": 24, + "line": 18, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 299, + 300, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 294, + 300, + ], + "type": "MemberExpression", + }, + "expression": true, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 25, + "line": 18, + }, + "start": Object { + "column": 13, + "line": 18, + }, + }, + "params": Array [], + "range": Array [ + 288, + 300, + ], + "returnType": undefined, + "type": "ArrowFunctionExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 25, + "line": 18, + }, + "start": Object { + "column": 8, + "line": 18, + }, + }, + "range": Array [ + 283, + 300, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "var", + "loc": Object { + "end": Object { + "column": 26, + "line": 18, + }, + "start": Object { + "column": 4, + "line": 18, + }, + }, + "range": Array [ + 279, + 301, + ], + "type": "VariableDeclaration", + }, + Object { + "argument": Object { + "arguments": Array [], + "callee": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 19, + }, + "start": Object { + "column": 11, + "line": 19, + }, + }, + "name": "fn", + "optional": false, + "range": Array [ + 313, + 315, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 19, + }, + "start": Object { + "column": 11, + "line": 19, + }, + }, + "optional": false, + "range": Array [ + 313, + 317, + ], + "type": "CallExpression", + "typeParameters": undefined, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 19, + }, + "start": Object { + "column": 4, + "line": 19, + }, + }, + "range": Array [ + 306, + 318, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 20, + }, + "start": Object { + "column": 34, + "line": 17, + }, + }, + "range": Array [ + 273, + 322, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 20, + }, + "start": Object { + "column": 16, + "line": 17, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 17, + }, + "start": Object { + "column": 17, + "line": 17, + }, + }, + "name": "this", + "optional": false, + "range": Array [ + 256, + 263, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 17, + }, + "start": Object { + "column": 21, + "line": 17, + }, + }, + "range": Array [ + 260, + 263, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 17, + }, + "start": Object { + "column": 23, + "line": 17, + }, + }, + "range": Array [ + 262, + 263, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 17, + }, + "start": Object { + "column": 23, + "line": 17, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 262, + 263, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 255, + 322, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 17, + }, + "start": Object { + "column": 25, + "line": 17, + }, + }, + "range": Array [ + 264, + 272, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 17, + }, + "start": Object { + "column": 27, + "line": 17, + }, + }, + "range": Array [ + 266, + 272, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 22, + }, + "start": Object { + "column": 9, + "line": 22, + }, + }, + "name": "staticMethod", + "optional": false, + "range": Array [ + 333, + 345, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 24, + }, + "start": Object { + "column": 2, + "line": 22, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 326, + 387, + ], + "static": true, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 17, + "line": 23, + }, + "start": Object { + "column": 11, + "line": 23, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 23, + }, + "start": Object { + "column": 11, + "line": 23, + }, + }, + "range": Array [ + 376, + 380, + ], + "type": "ThisExpression", + }, + "optional": false, + "property": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 23, + }, + "start": Object { + "column": 16, + "line": 23, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 381, + 382, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "range": Array [ + 376, + 382, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 18, + "line": 23, + }, + "start": Object { + "column": 4, + "line": 23, + }, + }, + "range": Array [ + 369, + 383, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 24, + }, + "start": Object { + "column": 39, + "line": 22, + }, + }, + "range": Array [ + 363, + 387, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 24, + }, + "start": Object { + "column": 21, + "line": 22, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 22, + }, + "start": Object { + "column": 22, + "line": 22, + }, + }, + "name": "this", + "optional": false, + "range": Array [ + 346, + 353, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 22, + }, + "start": Object { + "column": 26, + "line": 22, + }, + }, + "range": Array [ + 350, + 353, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 22, + }, + "start": Object { + "column": 28, + "line": 22, + }, + }, + "range": Array [ + 352, + 353, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 29, + "line": 22, + }, + "start": Object { + "column": 28, + "line": 22, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 352, + 353, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 345, + 387, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 22, + }, + "start": Object { + "column": 30, + "line": 22, + }, + }, + "range": Array [ + 354, + 362, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 22, + }, + "start": Object { + "column": 32, + "line": 22, + }, + }, + "range": Array [ + 356, + 362, + ], + "type": "TSNumberKeyword", + }, + }, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 26, + }, + "start": Object { + "column": 9, + "line": 26, + }, + }, + "name": "typeof", + "optional": false, + "range": Array [ + 398, + 404, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 28, + }, + "start": Object { + "column": 2, + "line": 26, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 391, + 449, + ], + "static": true, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 27, + }, + "start": Object { + "column": 18, + "line": 27, + }, + }, + "range": Array [ + 440, + 444, + ], + "type": "ThisExpression", + }, + "loc": Object { + "end": Object { + "column": 22, + "line": 27, + }, + "start": Object { + "column": 11, + "line": 27, + }, + }, + "operator": "typeof", + "prefix": true, + "range": Array [ + 433, + 444, + ], + "type": "UnaryExpression", + }, + "loc": Object { + "end": Object { + "column": 23, + "line": 27, + }, + "start": Object { + "column": 4, + "line": 27, + }, + }, + "range": Array [ + 426, + 445, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 28, + }, + "start": Object { + "column": 31, + "line": 26, + }, + }, + "range": Array [ + 420, + 449, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 28, + }, + "start": Object { + "column": 15, + "line": 26, + }, + }, + "params": Array [ + Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 26, + }, + "start": Object { + "column": 16, + "line": 26, + }, + }, + "name": "this", + "optional": false, + "range": Array [ + 405, + 412, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 26, + }, + "start": Object { + "column": 20, + "line": 26, + }, + }, + "range": Array [ + 409, + 412, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 26, + }, + "start": Object { + "column": 22, + "line": 26, + }, + }, + "range": Array [ + 411, + 412, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 26, + }, + "start": Object { + "column": 22, + "line": 26, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 411, + 412, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 404, + 449, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 26, + }, + "start": Object { + "column": 24, + "line": 26, + }, + }, + "range": Array [ + 413, + 419, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 26, + }, + "start": Object { + "column": 26, + "line": 26, + }, + }, + "range": Array [ + 415, + 419, + ], + "type": "TSThisType", + }, + }, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 29, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 451, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "A", + "optional": false, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 29, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 451, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 30, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 452, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 7, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 12, + 18, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 2, + }, + "start": Object { + "column": 10, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 2, + }, + "start": Object { + "column": 12, + "line": 2, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 33, + 39, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + "value": "method", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 4, + }, + }, + "range": Array [ + 47, + 51, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 4, + }, + "start": Object { + "column": 20, + "line": 4, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 4, + }, + "start": Object { + "column": 22, + "line": 4, + }, + }, + "range": Array [ + 53, + 57, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 4, + }, + "start": Object { + "column": 27, + "line": 4, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 4, + }, + "start": Object { + "column": 29, + "line": 4, + }, + }, + "range": Array [ + 60, + 66, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 4, + }, + "start": Object { + "column": 36, + "line": 4, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 73, + 79, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 80, + 84, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 5, + }, + "start": Object { + "column": 16, + "line": 5, + }, + }, + "range": Array [ + 85, + 86, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 5, + }, + "start": Object { + "column": 17, + "line": 5, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 90, + 91, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 8, + }, + "start": Object { + "column": 2, + "line": 8, + }, + }, + "range": Array [ + 95, + 101, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 8, + }, + "start": Object { + "column": 9, + "line": 8, + }, + }, + "range": Array [ + 102, + 109, + ], + "type": "Identifier", + "value": "method2", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 8, + }, + "start": Object { + "column": 16, + "line": 8, + }, + }, + "range": Array [ + 109, + 110, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 8, + }, + "start": Object { + "column": 17, + "line": 8, + }, + }, + "range": Array [ + 110, + 114, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 8, + }, + "start": Object { + "column": 21, + "line": 8, + }, + }, + "range": Array [ + 114, + 115, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 8, + }, + "start": Object { + "column": 23, + "line": 8, + }, + }, + "range": Array [ + 116, + 117, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 8, + }, + "start": Object { + "column": 24, + "line": 8, + }, + }, + "range": Array [ + 117, + 118, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 8, + }, + "start": Object { + "column": 25, + "line": 8, + }, + }, + "range": Array [ + 118, + 119, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 8, + }, + "start": Object { + "column": 27, + "line": 8, + }, + }, + "range": Array [ + 120, + 124, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 8, + }, + "start": Object { + "column": 32, + "line": 8, + }, + }, + "range": Array [ + 125, + 126, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 9, + }, + "start": Object { + "column": 4, + "line": 9, + }, + }, + "range": Array [ + 131, + 137, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 9, + }, + "start": Object { + "column": 11, + "line": 9, + }, + }, + "range": Array [ + 138, + 142, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 9, + }, + "start": Object { + "column": 15, + "line": 9, + }, + }, + "range": Array [ + 142, + 143, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 9, + }, + "start": Object { + "column": 16, + "line": 9, + }, + }, + "range": Array [ + 143, + 144, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 9, + }, + "start": Object { + "column": 17, + "line": 9, + }, + }, + "range": Array [ + 144, + 145, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 10, + }, + "start": Object { + "column": 2, + "line": 10, + }, + }, + "range": Array [ + 148, + 149, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 12, + }, + "start": Object { + "column": 2, + "line": 12, + }, + }, + "range": Array [ + 153, + 159, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 12, + }, + "start": Object { + "column": 9, + "line": 12, + }, + }, + "range": Array [ + 160, + 167, + ], + "type": "Identifier", + "value": "method3", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 12, + }, + "start": Object { + "column": 16, + "line": 12, + }, + }, + "range": Array [ + 167, + 168, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 12, + }, + "start": Object { + "column": 17, + "line": 12, + }, + }, + "range": Array [ + 168, + 172, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 12, + }, + "start": Object { + "column": 21, + "line": 12, + }, + }, + "range": Array [ + 172, + 173, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 12, + }, + "start": Object { + "column": 23, + "line": 12, + }, + }, + "range": Array [ + 174, + 178, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 12, + }, + "start": Object { + "column": 27, + "line": 12, + }, + }, + "range": Array [ + 178, + 179, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 12, + }, + "start": Object { + "column": 28, + "line": 12, + }, + }, + "range": Array [ + 179, + 180, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 12, + }, + "start": Object { + "column": 30, + "line": 12, + }, + }, + "range": Array [ + 181, + 187, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 12, + }, + "start": Object { + "column": 37, + "line": 12, + }, + }, + "range": Array [ + 188, + 189, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 13, + }, + "start": Object { + "column": 4, + "line": 13, + }, + }, + "range": Array [ + 194, + 197, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 13, + }, + "start": Object { + "column": 8, + "line": 13, + }, + }, + "range": Array [ + 198, + 200, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 13, + }, + "start": Object { + "column": 11, + "line": 13, + }, + }, + "range": Array [ + 201, + 202, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 13, + }, + "start": Object { + "column": 13, + "line": 13, + }, + }, + "range": Array [ + 203, + 204, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 13, + }, + "start": Object { + "column": 14, + "line": 13, + }, + }, + "range": Array [ + 204, + 205, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 13, + }, + "start": Object { + "column": 16, + "line": 13, + }, + }, + "range": Array [ + 206, + 208, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 13, + }, + "start": Object { + "column": 19, + "line": 13, + }, + }, + "range": Array [ + 209, + 213, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 13, + }, + "start": Object { + "column": 23, + "line": 13, + }, + }, + "range": Array [ + 213, + 214, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 13, + }, + "start": Object { + "column": 24, + "line": 13, + }, + }, + "range": Array [ + 214, + 215, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 13, + }, + "start": Object { + "column": 25, + "line": 13, + }, + }, + "range": Array [ + 215, + 216, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 14, + }, + "start": Object { + "column": 4, + "line": 14, + }, + }, + "range": Array [ + 221, + 227, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 14, + }, + "start": Object { + "column": 11, + "line": 14, + }, + }, + "range": Array [ + 228, + 230, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 14, + }, + "start": Object { + "column": 13, + "line": 14, + }, + }, + "range": Array [ + 230, + 231, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 14, + }, + "start": Object { + "column": 14, + "line": 14, + }, + }, + "range": Array [ + 231, + 232, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 14, + }, + "start": Object { + "column": 15, + "line": 14, + }, + }, + "range": Array [ + 232, + 233, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 15, + }, + "start": Object { + "column": 2, + "line": 15, + }, + }, + "range": Array [ + 236, + 237, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 17, + }, + "start": Object { + "column": 2, + "line": 17, + }, + }, + "range": Array [ + 241, + 247, + ], + "type": "Keyword", + "value": "public", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 17, + }, + "start": Object { + "column": 9, + "line": 17, + }, + }, + "range": Array [ + 248, + 255, + ], + "type": "Identifier", + "value": "method4", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 17, + }, + "start": Object { + "column": 16, + "line": 17, + }, + }, + "range": Array [ + 255, + 256, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 17, + }, + "start": Object { + "column": 17, + "line": 17, + }, + }, + "range": Array [ + 256, + 260, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 17, + }, + "start": Object { + "column": 21, + "line": 17, + }, + }, + "range": Array [ + 260, + 261, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 17, + }, + "start": Object { + "column": 23, + "line": 17, + }, + }, + "range": Array [ + 262, + 263, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 17, + }, + "start": Object { + "column": 24, + "line": 17, + }, + }, + "range": Array [ + 263, + 264, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 17, + }, + "start": Object { + "column": 25, + "line": 17, + }, + }, + "range": Array [ + 264, + 265, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 17, + }, + "start": Object { + "column": 27, + "line": 17, + }, + }, + "range": Array [ + 266, + 272, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 35, + "line": 17, + }, + "start": Object { + "column": 34, + "line": 17, + }, + }, + "range": Array [ + 273, + 274, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 18, + }, + "start": Object { + "column": 4, + "line": 18, + }, + }, + "range": Array [ + 279, + 282, + ], + "type": "Keyword", + "value": "var", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 18, + }, + "start": Object { + "column": 8, + "line": 18, + }, + }, + "range": Array [ + 283, + 285, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 18, + }, + "start": Object { + "column": 11, + "line": 18, + }, + }, + "range": Array [ + 286, + 287, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 18, + }, + "start": Object { + "column": 13, + "line": 18, + }, + }, + "range": Array [ + 288, + 289, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 18, + }, + "start": Object { + "column": 14, + "line": 18, + }, + }, + "range": Array [ + 289, + 290, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 18, + }, + "start": Object { + "column": 16, + "line": 18, + }, + }, + "range": Array [ + 291, + 293, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 18, + }, + "start": Object { + "column": 19, + "line": 18, + }, + }, + "range": Array [ + 294, + 298, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 18, + }, + "start": Object { + "column": 23, + "line": 18, + }, + }, + "range": Array [ + 298, + 299, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 18, + }, + "start": Object { + "column": 24, + "line": 18, + }, + }, + "range": Array [ + 299, + 300, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 18, + }, + "start": Object { + "column": 25, + "line": 18, + }, + }, + "range": Array [ + 300, + 301, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 19, + }, + "start": Object { + "column": 4, + "line": 19, + }, + }, + "range": Array [ + 306, + 312, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 19, + }, + "start": Object { + "column": 11, + "line": 19, + }, + }, + "range": Array [ + 313, + 315, + ], + "type": "Identifier", + "value": "fn", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 19, + }, + "start": Object { + "column": 13, + "line": 19, + }, + }, + "range": Array [ + 315, + 316, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 19, + }, + "start": Object { + "column": 14, + "line": 19, + }, + }, + "range": Array [ + 316, + 317, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 19, + }, + "start": Object { + "column": 15, + "line": 19, + }, + }, + "range": Array [ + 317, + 318, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 20, + }, + "start": Object { + "column": 2, + "line": 20, + }, + }, + "range": Array [ + 321, + 322, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 22, + }, + "start": Object { + "column": 2, + "line": 22, + }, + }, + "range": Array [ + 326, + 332, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 22, + }, + "start": Object { + "column": 9, + "line": 22, + }, + }, + "range": Array [ + 333, + 345, + ], + "type": "Identifier", + "value": "staticMethod", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 22, + }, + "start": Object { + "column": 21, + "line": 22, + }, + }, + "range": Array [ + 345, + 346, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 22, + }, + "start": Object { + "column": 22, + "line": 22, + }, + }, + "range": Array [ + 346, + 350, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 22, + }, + "start": Object { + "column": 26, + "line": 22, + }, + }, + "range": Array [ + 350, + 351, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 22, + }, + "start": Object { + "column": 28, + "line": 22, + }, + }, + "range": Array [ + 352, + 353, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 22, + }, + "start": Object { + "column": 29, + "line": 22, + }, + }, + "range": Array [ + 353, + 354, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 22, + }, + "start": Object { + "column": 30, + "line": 22, + }, + }, + "range": Array [ + 354, + 355, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 22, + }, + "start": Object { + "column": 32, + "line": 22, + }, + }, + "range": Array [ + 356, + 362, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 22, + }, + "start": Object { + "column": 39, + "line": 22, + }, + }, + "range": Array [ + 363, + 364, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 23, + }, + "start": Object { + "column": 4, + "line": 23, + }, + }, + "range": Array [ + 369, + 375, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 23, + }, + "start": Object { + "column": 11, + "line": 23, + }, + }, + "range": Array [ + 376, + 380, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 23, + }, + "start": Object { + "column": 15, + "line": 23, + }, + }, + "range": Array [ + 380, + 381, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 23, + }, + "start": Object { + "column": 16, + "line": 23, + }, + }, + "range": Array [ + 381, + 382, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 23, + }, + "start": Object { + "column": 17, + "line": 23, + }, + }, + "range": Array [ + 382, + 383, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 24, + }, + "start": Object { + "column": 2, + "line": 24, + }, + }, + "range": Array [ + 386, + 387, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 26, + }, + "start": Object { + "column": 2, + "line": 26, + }, + }, + "range": Array [ + 391, + 397, + ], + "type": "Keyword", + "value": "static", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 26, + }, + "start": Object { + "column": 9, + "line": 26, + }, + }, + "range": Array [ + 398, + 404, + ], + "type": "Keyword", + "value": "typeof", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 26, + }, + "start": Object { + "column": 15, + "line": 26, + }, + }, + "range": Array [ + 404, + 405, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 26, + }, + "start": Object { + "column": 16, + "line": 26, + }, + }, + "range": Array [ + 405, + 409, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 26, + }, + "start": Object { + "column": 20, + "line": 26, + }, + }, + "range": Array [ + 409, + 410, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 26, + }, + "start": Object { + "column": 22, + "line": 26, + }, + }, + "range": Array [ + 411, + 412, + ], + "type": "Identifier", + "value": "A", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 26, + }, + "start": Object { + "column": 23, + "line": 26, + }, + }, + "range": Array [ + 412, + 413, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 26, + }, + "start": Object { + "column": 24, + "line": 26, + }, + }, + "range": Array [ + 413, + 414, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 26, + }, + "start": Object { + "column": 26, + "line": 26, + }, + }, + "range": Array [ + 415, + 419, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 26, + }, + "start": Object { + "column": 31, + "line": 26, + }, + }, + "range": Array [ + 420, + 421, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 27, + }, + "start": Object { + "column": 4, + "line": 27, + }, + }, + "range": Array [ + 426, + 432, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 27, + }, + "start": Object { + "column": 11, + "line": 27, + }, + }, + "range": Array [ + 433, + 439, + ], + "type": "Keyword", + "value": "typeof", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 27, + }, + "start": Object { + "column": 18, + "line": 27, + }, + }, + "range": Array [ + 440, + 444, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 27, + }, + "start": Object { + "column": 22, + "line": 27, + }, + }, + "range": Array [ + 444, + 445, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 28, + }, + "start": Object { + "column": 2, + "line": 28, + }, + }, + "range": Array [ + 448, + 449, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 29, + }, + "start": Object { + "column": 0, + "line": 29, + }, + }, + "range": Array [ + 450, + 451, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/this-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/this-type.src.ts.shot new file mode 100644 index 00000000000..dfb9f035b1e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/this-type.src.ts.shot @@ -0,0 +1,500 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types this-type.src 1`] = ` +Object { + "body": Array [ + Object { + "abstract": false, + "body": Object { + "body": Array [ + Object { + "accessibility": undefined, + "computed": false, + "decorators": Array [], + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "name": "clone", + "optional": false, + "range": Array [ + 18, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "kind": "method", + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "optional": false, + "override": false, + "range": Array [ + 18, + 54, + ], + "static": false, + "type": "MethodDefinition", + "typeParameters": undefined, + "value": Object { + "async": false, + "body": Object { + "body": Array [ + Object { + "argument": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 45, + 49, + ], + "type": "ThisExpression", + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 38, + 50, + ], + "type": "ReturnStatement", + }, + ], + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 54, + ], + "type": "BlockStatement", + }, + "declare": false, + "expression": false, + "generator": false, + "id": null, + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [], + "range": Array [ + 23, + 54, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 27, + 31, + ], + "type": "TSThisType", + }, + }, + "type": "FunctionExpression", + "typeParameters": undefined, + }, + }, + ], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 56, + ], + "type": "ClassBody", + }, + "declare": false, + "decorators": Array [], + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "name": "Message", + "optional": false, + "range": Array [ + 6, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "implements": Array [], + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 56, + ], + "superClass": null, + "superTypeParameters": undefined, + "type": "ClassDeclaration", + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 57, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "Keyword", + "value": "class", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 6, + "line": 1, + }, + }, + "range": Array [ + 6, + 13, + ], + "type": "Identifier", + "value": "Message", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 2, + "line": 2, + }, + }, + "range": Array [ + 18, + 23, + ], + "type": "Identifier", + "value": "clone", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 27, + 31, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 38, + 44, + ], + "type": "Keyword", + "value": "return", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 45, + 49, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 49, + 50, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "}", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-empty.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-empty.src.ts.shot new file mode 100644 index 00000000000..31ef4b0b176 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-empty.src.ts.shot @@ -0,0 +1,230 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types tuple-empty.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 9, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 9, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "elementTypes": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 9, + ], + "type": "TSTupleType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 9, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 10, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 11, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-optional.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-optional.src.ts.shot new file mode 100644 index 00000000000..492c7640640 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-optional.src.ts.shot @@ -0,0 +1,723 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types tuple-named-optional.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 53, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 53, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "elementTypes": Array [ + Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSStringKeyword", + }, + "label": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 8, + 17, + ], + "type": "TSNamedTupleMember", + }, + Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "TSNumberKeyword", + }, + "label": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "optional": true, + "range": Array [ + 19, + 29, + ], + "type": "TSNamedTupleMember", + }, + Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 51, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 51, + ], + "type": "TSNumberKeyword", + }, + ], + }, + "label": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "optional": true, + "range": Array [ + 31, + 52, + ], + "type": "TSNamedTupleMember", + }, + ], + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 53, + ], + "type": "TSTupleType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 53, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 53, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 54, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 42, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 51, + "line": 1, + }, + "start": Object { + "column": 45, + "line": 1, + }, + }, + "range": Array [ + 45, + 51, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 52, + "line": 1, + }, + "start": Object { + "column": 51, + "line": 1, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 1, + }, + "start": Object { + "column": 52, + "line": 1, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Punctuator", + "value": "]", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-rest.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-rest.src.ts.shot new file mode 100644 index 00000000000..11505c596b0 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-rest.src.ts.shot @@ -0,0 +1,539 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types tuple-named-rest.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 34, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 34, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "elementTypes": Array [ + Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSStringKeyword", + }, + "label": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 8, + 17, + ], + "type": "TSNamedTupleMember", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 33, + ], + "type": "TSRestType", + "typeAnnotation": Object { + "elementType": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "TSNumberKeyword", + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 33, + ], + "type": "TSArrayType", + }, + "label": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 22, + 33, + ], + "type": "TSNamedTupleMember", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 34, + ], + "type": "TSTupleType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 34, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 22, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 31, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "]", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-type.src.ts.shot new file mode 100644 index 00000000000..f7ba5633816 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named-type.src.ts.shot @@ -0,0 +1,432 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types tuple-named-type.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 34, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "elementTypes": Array [ + Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 21, + ], + "type": "TSStringKeyword", + }, + "label": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 12, + 21, + ], + "type": "TSNamedTupleMember", + }, + Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "TSStringKeyword", + }, + "label": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "optional": true, + "range": Array [ + 23, + 33, + ], + "type": "TSNamedTupleMember", + }, + ], + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 34, + ], + "type": "TSTupleType", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 35, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 21, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 33, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "]", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named.src.ts.shot new file mode 100644 index 00000000000..a86de6ac771 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-named.src.ts.shot @@ -0,0 +1,597 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types tuple-named.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 40, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 40, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "elementTypes": Array [ + Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSNumberKeyword", + }, + "label": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "a", + "optional": false, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 8, + 17, + ], + "type": "TSNamedTupleMember", + }, + Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "TSNumberKeyword", + }, + "label": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "name": "b", + "optional": false, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 19, + 28, + ], + "type": "TSNamedTupleMember", + }, + Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 39, + ], + "type": "TSNumberKeyword", + }, + "label": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "c", + "optional": false, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 30, + 39, + ], + "type": "TSNamedTupleMember", + }, + ], + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 40, + ], + "type": "TSTupleType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 40, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 41, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 42, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 28, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 39, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 1, + }, + "start": Object { + "column": 39, + "line": 1, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 41, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-optional.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-optional.src.ts.shot new file mode 100644 index 00000000000..ad8897ffae0 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-optional.src.ts.shot @@ -0,0 +1,532 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types tuple-optional.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 44, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 44, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "elementTypes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 14, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 23, + ], + "type": "TSOptionalType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "TSNumberKeyword", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 43, + ], + "type": "TSOptionalType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 41, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "TSNumberKeyword", + }, + ], + }, + }, + ], + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 44, + ], + "type": "TSTupleType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 44, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 44, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 45, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 14, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 32, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 1, + }, + "start": Object { + "column": 33, + "line": 1, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 41, + "line": 1, + }, + "start": Object { + "column": 35, + "line": 1, + }, + }, + "range": Array [ + 35, + 41, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 1, + }, + "start": Object { + "column": 41, + "line": 1, + }, + }, + "range": Array [ + 41, + 42, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 1, + }, + "start": Object { + "column": 42, + "line": 1, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 44, + "line": 1, + }, + "start": Object { + "column": 43, + "line": 1, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": "]", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-rest.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-rest.src.ts.shot new file mode 100644 index 00000000000..5171c6f702e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-rest.src.ts.shot @@ -0,0 +1,389 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types tuple-rest.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 28, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 28, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "elementTypes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 14, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 27, + ], + "type": "TSRestType", + "typeAnnotation": Object { + "elementType": Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "TSNumberKeyword", + }, + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 27, + ], + "type": "TSArrayType", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 28, + ], + "type": "TSTupleType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 28, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 14, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Punctuator", + "value": "...", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 25, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "]", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/tuple-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-type.src.ts.shot new file mode 100644 index 00000000000..6ee73194cf8 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/tuple-type.src.ts.shot @@ -0,0 +1,299 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types tuple-type.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 28, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "elementTypes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 18, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 27, + ], + "type": "TSOptionalType", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 26, + ], + "type": "TSStringKeyword", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 28, + ], + "type": "TSTupleType", + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 29, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 18, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 26, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "]", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/tuple.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/tuple.src.ts.shot new file mode 100644 index 00000000000..95c64e15805 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/tuple.src.ts.shot @@ -0,0 +1,372 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types tuple.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 31, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 31, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "elementTypes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 14, + ], + "type": "TSNumberKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "TSNumberKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 30, + ], + "type": "TSNumberKeyword", + }, + ], + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 31, + ], + "type": "TSTupleType", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 31, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 33, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 14, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 22, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 30, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/type-literal.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/type-literal.src.ts.shot new file mode 100644 index 00000000000..1e9de17e771 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/type-literal.src.ts.shot @@ -0,0 +1,364 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types type-literal.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "obj", + "optional": false, + "range": Array [ + 4, + 22, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 22, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "members": Array [ + Object { + "accessibility": undefined, + "computed": false, + "export": false, + "initializer": undefined, + "key": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "optional": false, + "range": Array [ + 11, + 20, + ], + "readonly": false, + "static": false, + "type": "TSPropertySignature", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 20, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "TSNumberKeyword", + }, + }, + }, + ], + "range": Array [ + 9, + 22, + ], + "type": "TSTypeLiteral", + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 22, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 23, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 24, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 7, + ], + "type": "Identifier", + "value": "obj", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "{", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 20, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "}", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/type-operator.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/type-operator.src.ts.shot new file mode 100644 index 00000000000..d983168c35e --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/type-operator.src.ts.shot @@ -0,0 +1,489 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types type-operator.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 14, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 14, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "operator": "keyof", + "range": Array [ + 7, + 14, + ], + "type": "TSTypeOperator", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "T", + "optional": false, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 14, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 15, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 20, + 36, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 21, + 36, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "operator": "unique", + "range": Array [ + 23, + 36, + ], + "type": "TSTypeOperator", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "TSSymbolKeyword", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 36, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 16, + 37, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 12, + ], + "type": "Identifier", + "value": "keyof", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 16, + 19, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 23, + 29, + ], + "type": "Identifier", + "value": "unique", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 14, + "line": 2, + }, + }, + "range": Array [ + 30, + 36, + ], + "type": "Identifier", + "value": "symbol", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/typeof-this.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/typeof-this.src.ts.shot new file mode 100644 index 00000000000..7c6652192d3 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/typeof-this.src.ts.shot @@ -0,0 +1,541 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types typeof-this.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "self", + "optional": false, + "range": Array [ + 4, + 21, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 21, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "exprName": Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "ThisExpression", + }, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 21, + ], + "type": "TSTypeQuery", + "typeParameters": undefined, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 21, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 27, + 47, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 30, + 47, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "exprName": Object { + "left": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 39, + 43, + ], + "type": "ThisExpression", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 39, + 47, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "name": "foo", + "optional": false, + "range": Array [ + 44, + 47, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "TSQualifiedName", + }, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 32, + 47, + ], + "type": "TSTypeQuery", + "typeParameters": undefined, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 27, + 47, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 23, + 48, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 49, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 8, + ], + "type": "Identifier", + "value": "self", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 10, + "line": 1, + }, + }, + "range": Array [ + 10, + 16, + ], + "type": "Keyword", + "value": "typeof", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 21, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 23, + 26, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 27, + 30, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 32, + 38, + ], + "type": "Keyword", + "value": "typeof", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 39, + 43, + ], + "type": "Keyword", + "value": "this", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 2, + }, + "start": Object { + "column": 20, + "line": 2, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 21, + "line": 2, + }, + }, + "range": Array [ + 44, + 47, + ], + "type": "Identifier", + "value": "foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/typeof-with-type-parameters.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/typeof-with-type-parameters.src.ts.shot new file mode 100644 index 00000000000..b31a8682418 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/typeof-with-type-parameters.src.ts.shot @@ -0,0 +1,436 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types typeof-with-type-parameters.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 20, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 20, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "exprName": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "TSQualifiedName", + }, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 20, + ], + "type": "TSTypeQuery", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "TSTypeReference", + "typeName": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "w", + "optional": false, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 17, + 20, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 20, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 21, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 22, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, + ], + "type": "Keyword", + "value": "typeof", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "w", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/typeof.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/typeof.src.ts.shot new file mode 100644 index 00000000000..14ef83b3343 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/typeof.src.ts.shot @@ -0,0 +1,325 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types typeof.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "x", + "optional": false, + "range": Array [ + 4, + 17, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 17, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "exprName": Object { + "left": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": "y", + "optional": false, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "right": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "name": "z", + "optional": false, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "type": "TSQualifiedName", + }, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 17, + ], + "type": "TSTypeQuery", + "typeParameters": undefined, + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 17, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 18, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 19, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 6, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 13, + ], + "type": "Keyword", + "value": "typeof", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "y", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ".", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Identifier", + "value": "z", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/union-intersection.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/union-intersection.src.ts.shot new file mode 100644 index 00000000000..613fbde6cd3 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/union-intersection.src.ts.shot @@ -0,0 +1,1248 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types union-intersection.src 1`] = ` +Object { + "body": Array [ + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "name": "union", + "optional": false, + "range": Array [ + 4, + 36, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 36, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 36, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSNumberKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 24, + ], + "type": "TSNullKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 36, + ], + "type": "TSUndefinedKeyword", + }, + ], + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 36, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "name": "intersection", + "optional": false, + "range": Array [ + 42, + 71, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 54, + 71, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 56, + 71, + ], + "type": "TSIntersectionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 56, + 62, + ], + "type": "TSNumberKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 65, + 71, + ], + "type": "TSStringKeyword", + }, + ], + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 42, + 71, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 38, + 72, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "name": "precedence1", + "optional": false, + "range": Array [ + 77, + 115, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 88, + 115, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 90, + 115, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 90, + 96, + ], + "type": "TSNumberKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 99, + 115, + ], + "type": "TSIntersectionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 99, + 105, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 35, + "line": 3, + }, + }, + "range": Array [ + 108, + 115, + ], + "type": "TSBooleanKeyword", + }, + ], + }, + ], + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 77, + 115, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 73, + 116, + ], + "type": "VariableDeclaration", + }, + Object { + "declarations": Array [ + Object { + "definite": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "name": "precedence2", + "optional": false, + "range": Array [ + 121, + 159, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 132, + 159, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 134, + 159, + ], + "type": "TSUnionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 134, + 149, + ], + "type": "TSIntersectionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 134, + 140, + ], + "type": "TSNumberKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "range": Array [ + 143, + 149, + ], + "type": "TSStringKeyword", + }, + ], + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "range": Array [ + 152, + 159, + ], + "type": "TSBooleanKeyword", + }, + ], + }, + }, + }, + "init": null, + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 121, + 159, + ], + "type": "VariableDeclarator", + }, + ], + "declare": false, + "kind": "let", + "loc": Object { + "end": Object { + "column": 43, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 117, + 160, + ], + "type": "VariableDeclaration", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 161, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 3, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 9, + ], + "type": "Identifier", + "value": "union", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 24, + ], + "type": "Keyword", + "value": "null", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 36, + ], + "type": "Identifier", + "value": "undefined", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 38, + 41, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 2, + }, + "start": Object { + "column": 4, + "line": 2, + }, + }, + "range": Array [ + 42, + 54, + ], + "type": "Identifier", + "value": "intersection", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 2, + }, + "start": Object { + "column": 16, + "line": 2, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 18, + "line": 2, + }, + }, + "range": Array [ + 56, + 62, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 2, + }, + "start": Object { + "column": 25, + "line": 2, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Punctuator", + "value": "&", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 2, + }, + "start": Object { + "column": 27, + "line": 2, + }, + }, + "range": Array [ + 65, + 71, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 2, + }, + "start": Object { + "column": 33, + "line": 2, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 73, + 76, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 77, + 88, + ], + "type": "Identifier", + "value": "precedence1", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 3, + }, + "start": Object { + "column": 17, + "line": 3, + }, + }, + "range": Array [ + 90, + 96, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 97, + 98, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 3, + }, + "start": Object { + "column": 26, + "line": 3, + }, + }, + "range": Array [ + 99, + 105, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 3, + }, + "start": Object { + "column": 33, + "line": 3, + }, + }, + "range": Array [ + 106, + 107, + ], + "type": "Punctuator", + "value": "&", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 3, + }, + "start": Object { + "column": 35, + "line": 3, + }, + }, + "range": Array [ + 108, + 115, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 3, + }, + "start": Object { + "column": 42, + "line": 3, + }, + }, + "range": Array [ + 115, + 116, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 117, + 120, + ], + "type": "Keyword", + "value": "let", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 121, + 132, + ], + "type": "Identifier", + "value": "precedence2", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 132, + 133, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 4, + }, + "start": Object { + "column": 17, + "line": 4, + }, + }, + "range": Array [ + 134, + 140, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 141, + 142, + ], + "type": "Punctuator", + "value": "&", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 26, + "line": 4, + }, + }, + "range": Array [ + 143, + 149, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 34, + "line": 4, + }, + "start": Object { + "column": 33, + "line": 4, + }, + }, + "range": Array [ + 150, + 151, + ], + "type": "Punctuator", + "value": "|", + }, + Object { + "loc": Object { + "end": Object { + "column": 42, + "line": 4, + }, + "start": Object { + "column": 35, + "line": 4, + }, + }, + "range": Array [ + 152, + 159, + ], + "type": "Identifier", + "value": "boolean", + }, + Object { + "loc": Object { + "end": Object { + "column": 43, + "line": 4, + }, + "start": Object { + "column": 42, + "line": 4, + }, + }, + "range": Array [ + 159, + 160, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/union-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/union-type.src.ts.shot new file mode 100644 index 00000000000..b4b333c34ac --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/union-type.src.ts.shot @@ -0,0 +1,228 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types union-type.src 1`] = ` +Object { + "body": Array [ + Object { + "declare": false, + "id": Object { + "decorators": Array [], + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Foo", + "optional": false, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "typeAnnotation": undefined, + }, + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 26, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 26, + ], + "type": "TSIntersectionType", + "types": Array [ + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "TSStringKeyword", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 26, + ], + "type": "TSNumberKeyword", + }, + ], + }, + "typeParameters": undefined, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 27, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 8, + ], + "type": "Identifier", + "value": "Foo", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 17, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "&", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 26, + ], + "type": "Identifier", + "value": "number", + }, + ], + "type": "Program", +} +`;