From 7d7e5455423a3239fd38a651d0f2693c06829755 Mon Sep 17 00:00:00 2001 From: Brad Zacher Date: Thu, 1 Apr 2021 15:22:01 -0700 Subject: [PATCH] feat(ast-spec): add fixtures Add fixture tests for each and every AST node. To make things more readable I: - separated the AST from the tokens - this stops the individual snapshot from being so long it's impossible to understand - if there are changes to tokens - then they should be more obvious now. Before you had to expand the snapshot in github to understand that the token was part of the tokens array. - always write error snapshot, and always write AST/token snapshots - This is just for consistency and to make it easier whilst you're developing. - It will prevent us from accidentally leaving behind error snapshots if they weren't supposed to be there. - added a custom snapshot serializer - Having learned how useful they are with scope manager - I created a new one to improve the look of the snapshots. - Instead of sorting alphabetically, I place `type` at the top, and `range`/`loc` at the end. - Instead of outputting `Object` ahead of every node, instead it outputs the node `type`. - I adjusted the output `range`/`loc` so they take up fewer lines and are more compact. I prefixed the snapshot names with numbers just so we can control the sorting of them. No other reason. --- .github/workflows/ci.yml | 7 + .nxignore | 2 + .prettierignore | 1 + .vscode/launch.json | 32 +++ .vscode/settings.json | 1 + package.json | 3 + packages/ast-spec/jest.config.js | 1 + packages/ast-spec/package.json | 12 + packages/ast-spec/src/base/TSHeritageBase.ts | 1 + .../implements-non-identifier/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixtures/_error_/no-body/fixture.ts | 1 + .../no-body/snapshots/1-TSESTree-Error.shot | 3 + .../no-body/snapshots/2-Babel-Error.shot | 3 + .../no-body/snapshots/3-Alignment-Error.shot | 3 + .../_error_/non-identifier-name/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixtures/abstract/fixture.ts | 1 + .../abstract/snapshots/1-TSESTree-AST.shot | 47 ++++ .../abstract/snapshots/2-TSESTree-Tokens.shot | 56 +++++ .../abstract/snapshots/3-Babel-AST.shot | 47 ++++ .../abstract/snapshots/4-Babel-Tokens.shot | 56 +++++ .../snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/declare/fixture.ts | 1 + .../declare/snapshots/1-TSESTree-AST.shot | 47 ++++ .../declare/snapshots/2-TSESTree-Tokens.shot | 56 +++++ .../declare/snapshots/3-Babel-AST.shot | 47 ++++ .../declare/snapshots/4-Babel-Tokens.shot | 56 +++++ .../snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/decoratorMany/fixture.ts | 3 + .../snapshots/1-TSESTree-AST.shot | 86 +++++++ .../snapshots/2-TSESTree-Tokens.shot | 86 +++++++ .../decoratorMany/snapshots/3-Babel-AST.shot | 86 +++++++ .../snapshots/4-Babel-Tokens.shot | 86 +++++++ .../snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/decoratorOne/fixture.ts | 2 + .../snapshots/1-TSESTree-AST.shot | 67 +++++ .../snapshots/2-TSESTree-Tokens.shot | 66 +++++ .../decoratorOne/snapshots/3-Babel-AST.shot | 67 +++++ .../snapshots/4-Babel-Tokens.shot | 66 +++++ .../snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/empty/fixture.ts | 1 + .../empty/snapshots/1-TSESTree-AST.shot | 46 ++++ .../empty/snapshots/2-TSESTree-Tokens.shot | 46 ++++ .../fixtures/empty/snapshots/3-Babel-AST.shot | 46 ++++ .../empty/snapshots/4-Babel-Tokens.shot | 46 ++++ .../empty/snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/extends-literal/README.md | 1 + .../fixtures/extends-literal/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 56 +++++ .../snapshots/2-TSESTree-Tokens.shot | 66 +++++ .../snapshots/3-Babel-AST.shot | 56 +++++ .../snapshots/4-Babel-Tokens.shot | 66 +++++ .../snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../extends-type-parameters/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 75 ++++++ .../snapshots/2-TSESTree-Tokens.shot | 96 ++++++++ .../snapshots/3-Babel-AST.shot | 75 ++++++ .../snapshots/4-Babel-Tokens.shot | 96 ++++++++ .../snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/extends/fixture.ts | 1 + .../extends/snapshots/1-TSESTree-AST.shot | 55 +++++ .../extends/snapshots/2-TSESTree-Tokens.shot | 66 +++++ .../extends/snapshots/3-Babel-AST.shot | 55 +++++ .../extends/snapshots/4-Babel-Tokens.shot | 66 +++++ .../snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/implements-many/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 105 ++++++++ .../snapshots/2-TSESTree-Tokens.shot | 106 ++++++++ .../snapshots/3-Babel-AST.shot | 105 ++++++++ .../snapshots/4-Babel-Tokens.shot | 106 ++++++++ .../snapshots/5-AST-Alignment-AST.shot | 115 +++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 112 +++++++++ .../fixtures/implements-one/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 67 +++++ .../snapshots/2-TSESTree-Tokens.shot | 66 +++++ .../implements-one/snapshots/3-Babel-AST.shot | 67 +++++ .../snapshots/4-Babel-Tokens.shot | 66 +++++ .../snapshots/5-AST-Alignment-AST.shot | 73 ++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 72 ++++++ .../fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 115 +++++++++ .../snapshots/2-TSESTree-Tokens.shot | 126 ++++++++++ .../snapshots/3-Babel-AST.shot | 106 ++++++++ .../snapshots/4-Babel-Tokens.shot | 126 ++++++++++ .../snapshots/5-AST-Alignment-AST.shot | 120 +++++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/type-parameters/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 76 ++++++ .../snapshots/2-TSESTree-Tokens.shot | 76 ++++++ .../snapshots/3-Babel-AST.shot | 67 +++++ .../snapshots/4-Babel-Tokens.shot | 76 ++++++ .../snapshots/5-AST-Alignment-AST.shot | 81 ++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../_error_/named-non-identifier/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixtures/_error_/no-source/fixture.ts | 1 + .../no-source/snapshots/1-TSESTree-Error.shot | 3 + .../no-source/snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../_error_/non-string-source/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixtures/_error_/type-kind/fixture.ts | 1 + .../type-kind/snapshots/1-TSESTree-Error.shot | 3 + .../type-kind/snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixtures/named/fixture.ts | 1 + .../named/snapshots/1-TSESTree-AST.shot | 47 ++++ .../named/snapshots/2-TSESTree-Tokens.shot | 76 ++++++ .../fixtures/named/snapshots/3-Babel-AST.shot | 47 ++++ .../named/snapshots/4-Babel-Tokens.shot | 76 ++++++ .../named/snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/unnamed/fixture.ts | 1 + .../unnamed/snapshots/1-TSESTree-AST.shot | 38 +++ .../unnamed/snapshots/2-TSESTree-Tokens.shot | 56 +++++ .../unnamed/snapshots/3-Babel-AST.shot | 38 +++ .../unnamed/snapshots/4-Babel-Tokens.shot | 56 +++++ .../snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/_error_/enum/fixture.ts | 1 + .../enum/snapshots/1-TSESTree-Error.shot | 3 + .../_error_/enum/snapshots/2-Babel-Error.shot | 3 + .../enum/snapshots/3-Alignment-Error.shot | 3 + .../fixtures/_error_/namespace/fixture.ts | 1 + .../namespace/snapshots/1-TSESTree-Error.shot | 3 + .../namespace/snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixtures/_error_/type-alias/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../type-alias/snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../_error_/variable-declaration/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixtures/anonymous-class/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 47 ++++ .../snapshots/2-TSESTree-Tokens.shot | 56 +++++ .../snapshots/3-Babel-AST.shot | 47 ++++ .../snapshots/4-Babel-Tokens.shot | 56 +++++ .../snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/anonymous-function/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 50 ++++ .../snapshots/2-TSESTree-Tokens.shot | 76 ++++++ .../snapshots/3-Babel-AST.shot | 50 ++++ .../snapshots/4-Babel-Tokens.shot | 76 ++++++ .../snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../arrow-function-expression/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 50 ++++ .../snapshots/2-TSESTree-Tokens.shot | 86 +++++++ .../snapshots/3-Babel-AST.shot | 50 ++++ .../snapshots/4-Babel-Tokens.shot | 86 +++++++ .../snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/class-expression/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 56 +++++ .../snapshots/2-TSESTree-Tokens.shot | 96 ++++++++ .../snapshots/3-Babel-AST.shot | 56 +++++ .../snapshots/4-Babel-Tokens.shot | 96 ++++++++ .../snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/class/fixture.ts | 1 + .../class/snapshots/1-TSESTree-AST.shot | 56 +++++ .../class/snapshots/2-TSESTree-Tokens.shot | 66 +++++ .../fixtures/class/snapshots/3-Babel-AST.shot | 56 +++++ .../class/snapshots/4-Babel-Tokens.shot | 66 +++++ .../class/snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/function/fixture.ts | 1 + .../function/snapshots/1-TSESTree-AST.shot | 59 +++++ .../function/snapshots/2-TSESTree-Tokens.shot | 86 +++++++ .../function/snapshots/3-Babel-AST.shot | 59 +++++ .../function/snapshots/4-Babel-Tokens.shot | 86 +++++++ .../snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/identifier/fixture.ts | 1 + .../identifier/snapshots/1-TSESTree-AST.shot | 36 +++ .../snapshots/2-TSESTree-Tokens.shot | 46 ++++ .../identifier/snapshots/3-Babel-AST.shot | 36 +++ .../identifier/snapshots/4-Babel-Tokens.shot | 46 ++++ .../snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/interface/fixture.ts | 1 + .../interface/snapshots/1-TSESTree-AST.shot | 55 +++++ .../snapshots/2-TSESTree-Tokens.shot | 66 +++++ .../interface/snapshots/3-Babel-AST.shot | 55 +++++ .../interface/snapshots/4-Babel-Tokens.shot | 66 +++++ .../snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 72 ++++++ .../fixtures/literal/fixture.ts | 1 + .../literal/snapshots/1-TSESTree-AST.shot | 37 +++ .../literal/snapshots/2-TSESTree-Tokens.shot | 46 ++++ .../literal/snapshots/3-Babel-AST.shot | 37 +++ .../literal/snapshots/4-Babel-Tokens.shot | 46 ++++ .../snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../ExportDefaultDeclaration/spec.ts | 6 +- .../_error_/aliased-literal/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../_error_/anonymous-class/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../anonymous-function-expression/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../_error_/arrow-function/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../_error_/class-expression/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../_error_/identifier-direct/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../_error_/literal-braced/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 6 + .../snapshots/3-Alignment-Error.shot | 3 + .../_error_/literal-direct/fixture.ts | 1 + .../snapshots/1-TSESTree-Error.shot | 3 + .../snapshots/2-Babel-Error.shot | 3 + .../snapshots/3-Alignment-Error.shot | 3 + .../fixtures/aliased/fixture.ts | 1 + .../aliased/snapshots/1-TSESTree-AST.shot | 59 +++++ .../aliased/snapshots/2-TSESTree-Tokens.shot | 76 ++++++ .../aliased/snapshots/3-Babel-AST.shot | 59 +++++ .../aliased/snapshots/4-Babel-Tokens.shot | 76 ++++++ .../snapshots/5-AST-Alignment-AST.shot | 64 +++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/class/fixture.ts | 1 + .../class/snapshots/1-TSESTree-AST.shot | 58 +++++ .../class/snapshots/2-TSESTree-Tokens.shot | 56 +++++ .../fixtures/class/snapshots/3-Babel-AST.shot | 58 +++++ .../class/snapshots/4-Babel-Tokens.shot | 56 +++++ .../class/snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/declare-function/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 70 ++++++ .../snapshots/2-TSESTree-Tokens.shot | 96 ++++++++ .../snapshots/3-Babel-AST.shot | 70 ++++++ .../snapshots/4-Babel-Tokens.shot | 96 ++++++++ .../snapshots/5-AST-Alignment-AST.shot | 75 ++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/enum/fixture.ts | 1 + .../enum/snapshots/1-TSESTree-AST.shot | 48 ++++ .../enum/snapshots/2-TSESTree-Tokens.shot | 56 +++++ .../fixtures/enum/snapshots/3-Babel-AST.shot | 48 ++++ .../enum/snapshots/4-Babel-Tokens.shot | 56 +++++ .../enum/snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 62 +++++ .../fixtures/function-declaration/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 61 +++++ .../snapshots/2-TSESTree-Tokens.shot | 76 ++++++ .../snapshots/3-Babel-AST.shot | 61 +++++ .../snapshots/4-Babel-Tokens.shot | 76 ++++++ .../snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/identifier-braced/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 59 +++++ .../snapshots/2-TSESTree-Tokens.shot | 56 +++++ .../snapshots/3-Babel-AST.shot | 59 +++++ .../snapshots/4-Babel-Tokens.shot | 56 +++++ .../snapshots/5-AST-Alignment-AST.shot | 64 +++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/identifier-many/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 88 +++++++ .../snapshots/2-TSESTree-Tokens.shot | 76 ++++++ .../snapshots/3-Babel-AST.shot | 88 +++++++ .../snapshots/4-Babel-Tokens.shot | 76 ++++++ .../snapshots/5-AST-Alignment-AST.shot | 93 +++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/interface/fixture.ts | 1 + .../interface/snapshots/1-TSESTree-AST.shot | 57 +++++ .../snapshots/2-TSESTree-Tokens.shot | 56 +++++ .../interface/snapshots/3-Babel-AST.shot | 57 +++++ .../interface/snapshots/4-Babel-Tokens.shot | 56 +++++ .../snapshots/5-AST-Alignment-AST.shot | 62 +++++ .../snapshots/6-AST-Alignment-Tokens.shot | 62 +++++ .../fixtures/namespace/fixture.ts | 1 + .../namespace/snapshots/1-TSESTree-AST.shot | 57 +++++ .../snapshots/2-TSESTree-Tokens.shot | 56 +++++ .../namespace/snapshots/3-Babel-AST.shot | 57 +++++ .../namespace/snapshots/4-Babel-Tokens.shot | 56 +++++ .../snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/type-alias/fixture.ts | 1 + .../type-alias/snapshots/1-TSESTree-AST.shot | 67 +++++ .../snapshots/2-TSESTree-Tokens.shot | 66 +++++ .../type-alias/snapshots/3-Babel-AST.shot | 67 +++++ .../type-alias/snapshots/4-Babel-Tokens.shot | 66 +++++ .../snapshots/5-AST-Alignment-AST.shot | 72 ++++++ .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../fixtures/variable-declaration/fixture.ts | 1 + .../snapshots/1-TSESTree-AST.shot | 70 ++++++ .../snapshots/2-TSESTree-Tokens.shot | 66 +++++ .../snapshots/3-Babel-AST.shot | 70 ++++++ .../snapshots/4-Babel-Tokens.shot | 66 +++++ .../snapshots/5-AST-Alignment-AST.shot | 6 + .../snapshots/6-AST-Alignment-Tokens.shot | 6 + .../ExportNamedDeclaration/spec.ts | 1 + ....ts => PunctuatorTokenToText.type-test.ts} | 0 ...es.test.ts => ast-node-types.type-test.ts} | 0 .../tests/fixtures-with-differences-ast.shot | 16 ++ .../fixtures-with-differences-errors.shot | 15 ++ .../fixtures-with-differences-tokens.shot | 11 + packages/ast-spec/tests/fixtures.test.ts | 230 ++++++++++++++++++ packages/ast-spec/tests/util/parsers/babel.ts | 49 ++++ .../tests/util/parsers/parser-types.ts | 33 +++ .../tests/util/parsers/typescript-estree.ts | 33 +++ .../ast-spec/tests/util/serializers/Node.ts | 83 +++++++ .../ast-spec/tests/util/serializers/index.ts | 6 + .../ast-spec/tests/util/serializers/string.ts | 38 +++ packages/ast-spec/tests/util/setupJest.ts | 8 + packages/ast-spec/tests/util/snapshot-diff.ts | 65 +++++ .../tests/util/typescript-estree-import.ts | 17 ++ packages/ast-spec/tsconfig.build.json | 3 +- packages/ast-spec/tsconfig.json | 4 +- .../ast-spec/typings/babel-eslint-parser.d.ts | 24 ++ packages/scope-manager/package.json | 1 + packages/scope-manager/tests/fixtures.test.ts | 2 +- packages/types/tools/copy-ast-spec.ts | 40 ++- .../visitor-keys/tests/visitor-keys.test.ts | 5 + yarn.lock | 93 +++---- 349 files changed, 11463 insertions(+), 52 deletions(-) create mode 100644 .nxignore create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/README.md create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/no-source/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/no-source/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/no-source/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/no-source/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/type-kind/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/type-kind/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/type-kind/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/type-kind/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/1-TSESTree-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/2-Babel-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/3-Alignment-Error.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/6-AST-Alignment-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/fixture.ts create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/1-TSESTree-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/2-TSESTree-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/3-Babel-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/4-Babel-Tokens.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/5-AST-Alignment-AST.shot create mode 100644 packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/6-AST-Alignment-Tokens.shot rename packages/ast-spec/tests/{PunctuatorTokenToText.test.ts => PunctuatorTokenToText.type-test.ts} (100%) rename packages/ast-spec/tests/{ast-node-types.test.ts => ast-node-types.type-test.ts} (100%) create mode 100644 packages/ast-spec/tests/fixtures-with-differences-ast.shot create mode 100644 packages/ast-spec/tests/fixtures-with-differences-errors.shot create mode 100644 packages/ast-spec/tests/fixtures-with-differences-tokens.shot create mode 100644 packages/ast-spec/tests/fixtures.test.ts create mode 100644 packages/ast-spec/tests/util/parsers/babel.ts create mode 100644 packages/ast-spec/tests/util/parsers/parser-types.ts create mode 100644 packages/ast-spec/tests/util/parsers/typescript-estree.ts create mode 100644 packages/ast-spec/tests/util/serializers/Node.ts create mode 100644 packages/ast-spec/tests/util/serializers/index.ts create mode 100644 packages/ast-spec/tests/util/serializers/string.ts create mode 100644 packages/ast-spec/tests/util/setupJest.ts create mode 100644 packages/ast-spec/tests/util/snapshot-diff.ts create mode 100644 packages/ast-spec/tests/util/typescript-estree-import.ts create mode 100644 packages/ast-spec/typings/babel-eslint-parser.d.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5acbec2c9c7..cc3fff820c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,6 +94,12 @@ jobs: run: | yarn build + - name: Run unit tests for ast-spec + run: yarn test + working-directory: packages/ast-spec + env: + CI: true + - name: Run unit tests for typescript-estree run: npx nx test @typescript-eslint/typescript-estree env: @@ -292,6 +298,7 @@ jobs: env: CI: true + # ast-spec is internal only - so don't care about compat on other versions # eslint-plugin-internal is internal only - so don't care about compat on other versions publish_canary_version: diff --git a/.nxignore b/.nxignore new file mode 100644 index 00000000000..8f084f13c12 --- /dev/null +++ b/.nxignore @@ -0,0 +1,2 @@ +# See the notes in the file for why this is needed +packages/ast-spec/tests/util/typescript-estree-import.ts diff --git a/.prettierignore b/.prettierignore index 8212dba92be..54a6250a62c 100644 --- a/.prettierignore +++ b/.prettierignore @@ -12,6 +12,7 @@ packages/eslint-plugin-tslint/tests/test-tslint-rules-directory/alwaysFailRule.j packages/eslint-plugin/src/configs/*.json .all-contributorsrc CONTRIBUTORS.md +packages/ast-spec/src/*/*/fixtures/_error_/*/fixture.ts # Ignore CHANGELOG.md files to avoid issues with automated release job CHANGELOG.md diff --git a/.vscode/launch.json b/.vscode/launch.json index 5ad1e226457..0f3f02d6324 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -196,5 +196,37 @@ "${workspaceFolder}/packages/scope-manager/dist/index.js", ], }, + { + "type": "node", + "request": "launch", + "name": "Run currently opened ast-spec test", + "cwd": "${workspaceFolder}/packages/ast-spec/", + "program": "${workspaceFolder}/node_modules/jest/bin/jest.js", + "args": [ + "--runInBand", + "--no-cache", + "--no-coverage", + "${fileBasename}" + ], + "sourceMaps": true, + "console": "integratedTerminal", + "internalConsoleOptions": "neverOpen", + "skipFiles": [ + "${workspaceFolder}/packages/experimental-utils/src/index.ts", + "${workspaceFolder}/packages/experimental-utils/dist/index.js", + "${workspaceFolder}/packages/experimental-utils/src/ts-estree.ts", + "${workspaceFolder}/packages/experimental-utils/dist/ts-estree.js", + "${workspaceFolder}/packages/parser/src/index.ts", + "${workspaceFolder}/packages/parser/dist/index.js", + "${workspaceFolder}/packages/typescript-estree/src/index.ts", + "${workspaceFolder}/packages/typescript-estree/dist/index.js", + "${workspaceFolder}/packages/types/src/index.ts", + "${workspaceFolder}/packages/types/dist/index.js", + "${workspaceFolder}/packages/visitor-keys/src/index.ts", + "${workspaceFolder}/packages/visitor-keys/dist/index.js", + "${workspaceFolder}/packages/scope-manager/dist/index.js", + "${workspaceFolder}/packages/scope-manager/dist/index.js", + ], + }, ] } diff --git a/.vscode/settings.json b/.vscode/settings.json index f0677068d03..a1fbaa7ddc1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -31,6 +31,7 @@ ".tsx.shot", ".js.shot", ".jsx.shot", + ".shot", ], "extends": "jest_snapshot" }, diff --git a/package.json b/package.json index 9a570185529..cde0645affe 100644 --- a/package.json +++ b/package.json @@ -72,6 +72,7 @@ }, "devDependencies": { "@babel/code-frame": "^7.14.5", + "@babel/eslint-parser": "^7.15.4", "@babel/parser": "^7.15.7", "@babel/types": "^7.15.6", "@commitlint/cli": "^13.1.0", @@ -109,6 +110,8 @@ "glob": "^7.1.7", "husky": "^7.0.4", "jest": "^27.3.1", + "jest-diff": "^27.3.1", + "jest-snapshot": "^27.3.1", "jest-specific-snapshot": "^5.0.0", "lerna": "^3.22.1", "lint-staged": "^11.1.2", diff --git a/packages/ast-spec/jest.config.js b/packages/ast-spec/jest.config.js index c23ca67fbc6..7de4ca2259c 100644 --- a/packages/ast-spec/jest.config.js +++ b/packages/ast-spec/jest.config.js @@ -17,4 +17,5 @@ module.exports = { collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'], moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], coverageReporters: ['text-summary', 'lcov'], + setupFilesAfterEnv: ['./tests/util/setupJest.ts'], }; diff --git a/packages/ast-spec/package.json b/packages/ast-spec/package.json index dad8afb2e9d..363693e4509 100644 --- a/packages/ast-spec/package.json +++ b/packages/ast-spec/package.json @@ -32,8 +32,10 @@ "build": "tsc -b tsconfig.build.json && api-extractor run --local", "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf _ts3.4 && rimraf .rollup.cache && rimraf coverage", + "clean-fixtures": "rimraf -g \"./src/**/fixtures/**/snapshots\"", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", + "test": "jest", "typecheck": "tsc -p tsconfig.json --noEmit" }, "funding": { @@ -41,7 +43,17 @@ "url": "https://opencollective.com/typescript-eslint" }, "devDependencies": { + "@babel/core": "*", + "@babel/eslint-parser": "*", + "@babel/parser": "*", "@microsoft/api-extractor": "^7.18.16", + "@types/babel__core": "*", + "glob": "*", + "jest-diff": "*", + "jest-snapshot": "*", + "jest-specific-snapshot": "*", + "make-dir": "*", + "pretty-format": "*", "typescript": "*" } } diff --git a/packages/ast-spec/src/base/TSHeritageBase.ts b/packages/ast-spec/src/base/TSHeritageBase.ts index b3ed1770b67..5c20542e4f9 100644 --- a/packages/ast-spec/src/base/TSHeritageBase.ts +++ b/packages/ast-spec/src/base/TSHeritageBase.ts @@ -3,6 +3,7 @@ import type { Expression } from '../unions/Expression'; import type { BaseNode } from './BaseNode'; export interface TSHeritageBase extends BaseNode { + // TODO(error handling) - this should be restricted to MemberExpression | Identifier expression: Expression; typeParameters?: TSTypeParameterInstantiation; } diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/fixture.ts new file mode 100644 index 00000000000..d9bb750ada2 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/fixture.ts @@ -0,0 +1 @@ +class Foo implements 'thing' {} diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..d4b25d3584b --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ implements-non-identifier TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..32918ff7c5f --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ implements-non-identifier Babel - Error 1`] = `[SyntaxError: Unexpected token (1:21)]`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..123225a1825 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ implements-non-identifier Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/fixture.ts new file mode 100644 index 00000000000..12cf01a79ca --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/fixture.ts @@ -0,0 +1 @@ +class Foo; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..30525843580 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ no-body TSESTree - Error 1`] = `[TSError: '{' expected.]`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..e72c371e842 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ no-body Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:9)]`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..b6946023222 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ no-body Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/fixture.ts new file mode 100644 index 00000000000..140ca7e5d56 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/fixture.ts @@ -0,0 +1 @@ +class 'Foo' {} diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..7b137a8c5de --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ non-identifier-name TSESTree - Error 1`] = `[TSError: '{' expected.]`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..e3a40451c7e --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ non-identifier-name Babel - Error 1`] = `[SyntaxError: A class name is required. (1:6)]`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..098ed5e7a14 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-name/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ non-identifier-name Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/fixture.ts new file mode 100644 index 00000000000..57d09b35b4c --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/fixture.ts @@ -0,0 +1 @@ +abstract class Foo {} 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 new file mode 100644 index 00000000000..bae3f5a8287 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,47 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration abstract TSESTree - AST 1`] = ` +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 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + 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/abstract/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..0cda2312006 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration abstract TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..d8e3d045b84 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/3-Babel-AST.shot @@ -0,0 +1,47 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration abstract Babel - AST 1`] = ` +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 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + 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/abstract/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..ac5930044d1 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration abstract Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "abstract", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [9, 14], + loc: { + start: { column: 9, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..54a7219ce9a --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration abstract AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..248c67fcb6a --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/abstract/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration abstract AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/fixture.ts new file mode 100644 index 00000000000..a12e8045e83 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/fixture.ts @@ -0,0 +1 @@ +declare class Foo {} 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 new file mode 100644 index 00000000000..d20ffd3e130 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,47 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration declare TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [18, 20], + loc: { + start: { column: 18, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + declare: true, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + 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/declare/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..4006c278dcb --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration declare TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [8, 13], + loc: { + start: { column: 8, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..27ac3a41954 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/3-Babel-AST.shot @@ -0,0 +1,47 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration declare Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [18, 20], + loc: { + start: { column: 18, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + declare: true, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + 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/declare/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..0fbe7f7fe38 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration declare Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [8, 13], + loc: { + start: { column: 8, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [14, 17], + loc: { + start: { column: 14, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..9fbaa86d5a2 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration declare AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..1bb1eef41ab --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/declare/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration declare AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/fixture.ts new file mode 100644 index 00000000000..259743a73f7 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/fixture.ts @@ -0,0 +1,3 @@ +@decoratorOne +@decoratorTwo +class Foo {} diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..ab7726fcd52 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration decoratorMany TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [38, 40], + loc: { + start: { column: 10, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + decorators: Array [ + Decorator { + type: "Decorator", + expression: Identifier { + type: "Identifier", + name: "decoratorOne", + + 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", + name: "decoratorTwo", + + 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", + name: "Foo", + + range: [34, 37], + loc: { + start: { column: 6, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + 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/decoratorMany/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..f406c812335 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration decoratorMany TSESTree - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "@", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "decoratorOne", + + range: [1, 13], + loc: { + start: { column: 1, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "@", + + range: [14, 15], + loc: { + start: { column: 0, line: 2 }, + end: { column: 1, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "decoratorTwo", + + range: [15, 27], + loc: { + start: { column: 1, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [28, 33], + loc: { + start: { column: 0, line: 3 }, + end: { column: 5, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [34, 37], + loc: { + start: { column: 6, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [38, 39], + loc: { + start: { column: 10, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [39, 40], + loc: { + start: { column: 11, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..60af58e326d --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/3-Babel-AST.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration decoratorMany Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [38, 40], + loc: { + start: { column: 10, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, + decorators: Array [ + Decorator { + type: "Decorator", + expression: Identifier { + type: "Identifier", + name: "decoratorOne", + + 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", + name: "decoratorTwo", + + 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", + name: "Foo", + + range: [34, 37], + loc: { + start: { column: 6, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + 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/decoratorMany/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..888d2f213d3 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration decoratorMany Babel - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "@", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "decoratorOne", + + range: [1, 13], + loc: { + start: { column: 1, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "@", + + range: [14, 15], + loc: { + start: { column: 0, line: 2 }, + end: { column: 1, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "decoratorTwo", + + range: [15, 27], + loc: { + start: { column: 1, line: 2 }, + end: { column: 13, line: 2 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [28, 33], + loc: { + start: { column: 0, line: 3 }, + end: { column: 5, line: 3 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [34, 37], + loc: { + start: { column: 6, line: 3 }, + end: { column: 9, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [38, 39], + loc: { + start: { column: 10, line: 3 }, + end: { column: 11, line: 3 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [39, 40], + loc: { + start: { column: 11, line: 3 }, + end: { column: 12, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..97881c1404c --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration decoratorMany AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..e57e9fa7313 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration decoratorMany AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/fixture.ts new file mode 100644 index 00000000000..3db0178e0a4 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/fixture.ts @@ -0,0 +1,2 @@ +@decorator +class Foo {} diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..f0550dcabbe --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,67 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration decoratorOne TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [21, 23], + loc: { + start: { column: 10, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + decorators: Array [ + Decorator { + type: "Decorator", + expression: Identifier { + type: "Identifier", + name: "decorator", + + 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", + name: "Foo", + + range: [17, 20], + loc: { + start: { column: 6, line: 2 }, + end: { column: 9, line: 2 }, + }, + }, + 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/decoratorOne/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..7354a4e9bfe --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration decoratorOne TSESTree - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "@", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "decorator", + + range: [1, 10], + loc: { + start: { column: 1, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [11, 16], + loc: { + start: { column: 0, line: 2 }, + end: { column: 5, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [17, 20], + loc: { + start: { column: 6, line: 2 }, + end: { column: 9, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [21, 22], + loc: { + start: { column: 10, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [22, 23], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..f2e4581ba58 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/3-Babel-AST.shot @@ -0,0 +1,67 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration decoratorOne Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [21, 23], + loc: { + start: { column: 10, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + decorators: Array [ + Decorator { + type: "Decorator", + expression: Identifier { + type: "Identifier", + name: "decorator", + + 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", + name: "Foo", + + range: [17, 20], + loc: { + start: { column: 6, line: 2 }, + end: { column: 9, line: 2 }, + }, + }, + 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/decoratorOne/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..eb1816cba73 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration decoratorOne Babel - Tokens 1`] = ` +Array [ + Punctuator { + type: "Punctuator", + value: "@", + + range: [0, 1], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "decorator", + + range: [1, 10], + loc: { + start: { column: 1, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [11, 16], + loc: { + start: { column: 0, line: 2 }, + end: { column: 5, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [17, 20], + loc: { + start: { column: 6, line: 2 }, + end: { column: 9, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [21, 22], + loc: { + start: { column: 10, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [22, 23], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..19b8f62ee26 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration decoratorOne AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..915fd1d51f9 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration decoratorOne AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/fixture.ts new file mode 100644 index 00000000000..4e6a6de6531 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/fixture.ts @@ -0,0 +1 @@ +class Foo {} 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 new file mode 100644 index 00000000000..9ead7d30ab7 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration empty TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [10, 12], + loc: { + start: { column: 10, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + 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/empty/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..98e26f81f22 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration empty TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..b44e7f980bf --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/3-Babel-AST.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration empty Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [10, 12], + loc: { + start: { column: 10, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + 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/empty/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..7687be9ddb0 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration empty Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..795e34e032c --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration empty AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..bf9e1cf5e60 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/empty/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration empty AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/README.md b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/README.md new file mode 100644 index 00000000000..2e811c1316f --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/README.md @@ -0,0 +1 @@ +This is dumb code - but it's 100% syntactically valid and adheres to the ESTree spec. diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/fixture.ts new file mode 100644 index 00000000000..7bb36dc0067 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/fixture.ts @@ -0,0 +1 @@ +class Foo extends 'Thing' {} 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 new file mode 100644 index 00000000000..dc5437192e6 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration extends-literal TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [26, 28], + loc: { + start: { column: 26, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + 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-literal/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..578f3c6a864 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration extends-literal TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "extends", + + range: [10, 17], + loc: { + start: { column: 10, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + String { + type: "String", + value: "'Thing'", + + range: [18, 25], + loc: { + start: { column: 18, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..0a84daeb896 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/3-Babel-AST.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration extends-literal Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [26, 28], + loc: { + start: { column: 26, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + 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-literal/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..ec6443288fb --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration extends-literal Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "extends", + + range: [10, 17], + loc: { + start: { column: 10, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + String { + type: "String", + value: "'Thing'", + + range: [18, 25], + loc: { + start: { column: 18, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..432a1483eb4 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration extends-literal AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..5c213302190 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-literal/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration extends-literal AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/fixture.ts new file mode 100644 index 00000000000..5d0bc8ed7c7 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/fixture.ts @@ -0,0 +1 @@ +class Foo extends Set {} diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..da9fc3ba5ca --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,75 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration extends-type-parameters TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [30, 32], + loc: { + start: { column: 30, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: Identifier { + type: "Identifier", + name: "Set", + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + superTypeParameters: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSStringKeyword { + type: "TSStringKeyword", + + range: [22, 28], + loc: { + start: { column: 22, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + + range: [21, 29], + loc: { + start: { column: 21, line: 1 }, + end: { column: 29, 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/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..3eb2b515a24 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration extends-type-parameters TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "extends", + + range: [10, 17], + loc: { + start: { column: 10, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Set", + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "string", + + range: [22, 28], + loc: { + start: { column: 22, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [28, 29], + loc: { + start: { column: 28, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [31, 32], + loc: { + start: { column: 31, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..8f9634b6629 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/3-Babel-AST.shot @@ -0,0 +1,75 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration extends-type-parameters Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [30, 32], + loc: { + start: { column: 30, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: Identifier { + type: "Identifier", + name: "Set", + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + superTypeParameters: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSStringKeyword { + type: "TSStringKeyword", + + range: [22, 28], + loc: { + start: { column: 22, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + + range: [21, 29], + loc: { + start: { column: 21, line: 1 }, + end: { column: 29, 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/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..db93259e13a --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration extends-type-parameters Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "extends", + + range: [10, 17], + loc: { + start: { column: 10, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Set", + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "string", + + range: [22, 28], + loc: { + start: { column: 22, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [28, 29], + loc: { + start: { column: 28, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [31, 32], + loc: { + start: { column: 31, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..17f60ddc36a --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration extends-type-parameters AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..8c6277e35df --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration extends-type-parameters AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/fixture.ts new file mode 100644 index 00000000000..1f5fd8cad4e --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/fixture.ts @@ -0,0 +1 @@ +class Foo extends Object {} 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 new file mode 100644 index 00000000000..d8241f2f4d5 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,55 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration extends TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [25, 27], + loc: { + start: { column: 25, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: Identifier { + type: "Identifier", + name: "Object", + + 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/extends/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..1a912d35116 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration extends TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "extends", + + range: [10, 17], + loc: { + start: { column: 10, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Object", + + range: [18, 24], + loc: { + start: { column: 18, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..337d09683e9 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/3-Babel-AST.shot @@ -0,0 +1,55 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration extends Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [25, 27], + loc: { + start: { column: 25, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: Identifier { + type: "Identifier", + name: "Object", + + 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/extends/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..2f17f69fe6b --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration extends Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "extends", + + range: [10, 17], + loc: { + start: { column: 10, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Object", + + range: [18, 24], + loc: { + start: { column: 18, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..7408520a611 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration extends AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..ff9ee33e186 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration extends AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/fixture.ts new file mode 100644 index 00000000000..c0cae9a1115 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/fixture.ts @@ -0,0 +1 @@ +class Foo implements Object, Function, RegExp {} 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 new file mode 100644 index 00000000000..6467e4a37f0 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,105 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration implements-many TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [46, 48], + loc: { + start: { column: 46, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: Array [ + TSClassImplements { + type: "TSClassImplements", + expression: Identifier { + type: "Identifier", + name: "Object", + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + TSClassImplements { + type: "TSClassImplements", + expression: Identifier { + type: "Identifier", + name: "Function", + + range: [29, 37], + loc: { + start: { column: 29, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + + range: [29, 37], + loc: { + start: { column: 29, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + TSClassImplements { + type: "TSClassImplements", + expression: Identifier { + type: "Identifier", + name: "RegExp", + + range: [39, 45], + loc: { + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + + range: [39, 45], + loc: { + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + ], + superClass: null, + + 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/declaration/ClassDeclaration/fixtures/implements-many/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..ffe359159d4 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration implements-many TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "implements", + + range: [10, 20], + loc: { + start: { column: 10, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Object", + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Function", + + range: [29, 37], + loc: { + start: { column: 29, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [37, 38], + loc: { + start: { column: 37, line: 1 }, + end: { column: 38, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "RegExp", + + range: [39, 45], + loc: { + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [46, 47], + loc: { + start: { column: 46, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [47, 48], + loc: { + start: { column: 47, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..c5a75e6d5b1 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/3-Babel-AST.shot @@ -0,0 +1,105 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration implements-many Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [46, 48], + loc: { + start: { column: 46, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: Array [ + TSExpressionWithTypeArguments { + type: "TSExpressionWithTypeArguments", + expression: Identifier { + type: "Identifier", + name: "Object", + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + TSExpressionWithTypeArguments { + type: "TSExpressionWithTypeArguments", + expression: Identifier { + type: "Identifier", + name: "Function", + + range: [29, 37], + loc: { + start: { column: 29, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + + range: [29, 37], + loc: { + start: { column: 29, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + TSExpressionWithTypeArguments { + type: "TSExpressionWithTypeArguments", + expression: Identifier { + type: "Identifier", + name: "RegExp", + + range: [39, 45], + loc: { + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + + range: [39, 45], + loc: { + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + ], + superClass: null, + + 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/declaration/ClassDeclaration/fixtures/implements-many/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..ca4cb279c00 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration implements-many Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "implements", + + range: [10, 20], + loc: { + start: { column: 10, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Object", + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Function", + + range: [29, 37], + loc: { + start: { column: 29, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [37, 38], + loc: { + start: { column: 37, line: 1 }, + end: { column: 38, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "RegExp", + + range: [39, 45], + loc: { + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [46, 47], + loc: { + start: { column: 46, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [47, 48], + loc: { + start: { column: 47, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..77b0476655c --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,115 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration implements-many AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [46, 48], + loc: { + start: { column: 46, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: Array [ +- TSClassImplements { +- type: 'TSClassImplements', ++ TSExpressionWithTypeArguments { ++ type: 'TSExpressionWithTypeArguments', + expression: Identifier { + type: 'Identifier', + name: 'Object', + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, +- TSClassImplements { +- type: 'TSClassImplements', ++ TSExpressionWithTypeArguments { ++ type: 'TSExpressionWithTypeArguments', + expression: Identifier { + type: 'Identifier', + name: 'Function', + + range: [29, 37], + loc: { + start: { column: 29, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + + range: [29, 37], + loc: { + start: { column: 29, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, +- TSClassImplements { +- type: 'TSClassImplements', ++ TSExpressionWithTypeArguments { ++ type: 'TSExpressionWithTypeArguments', + expression: Identifier { + type: 'Identifier', + name: 'RegExp', + + range: [39, 45], + loc: { + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + + range: [39, 45], + loc: { + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + ], + superClass: null, + + 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/declaration/ClassDeclaration/fixtures/implements-many/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..931998b9e18 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-many/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,112 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration implements-many AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Keyword { + type: 'Keyword', + value: 'class', + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'implements', + + range: [10, 20], + loc: { + start: { column: 10, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'Object', + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ',', + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'Function', + + range: [29, 37], + loc: { + start: { column: 29, line: 1 }, + end: { column: 37, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ',', + + range: [37, 38], + loc: { + start: { column: 37, line: 1 }, + end: { column: 38, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'RegExp', + + range: [39, 45], + loc: { + start: { column: 39, line: 1 }, + end: { column: 45, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [46, 47], + loc: { + start: { column: 46, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [47, 48], + loc: { + start: { column: 47, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/fixture.ts new file mode 100644 index 00000000000..2e21f7b7833 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/fixture.ts @@ -0,0 +1 @@ +class Foo implements Object {} 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 new file mode 100644 index 00000000000..c5228690b09 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,67 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration implements-one TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [28, 30], + loc: { + start: { column: 28, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: Array [ + TSClassImplements { + type: "TSClassImplements", + expression: Identifier { + type: "Identifier", + name: "Object", + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + ], + superClass: null, + + 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/ClassDeclaration/fixtures/implements-one/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..160a01b3a57 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration implements-one TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "implements", + + range: [10, 20], + loc: { + start: { column: 10, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Object", + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [28, 29], + loc: { + start: { column: 28, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..de05a724a09 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/3-Babel-AST.shot @@ -0,0 +1,67 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration implements-one Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [28, 30], + loc: { + start: { column: 28, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: Array [ + TSExpressionWithTypeArguments { + type: "TSExpressionWithTypeArguments", + expression: Identifier { + type: "Identifier", + name: "Object", + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + ], + superClass: null, + + 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/ClassDeclaration/fixtures/implements-one/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..07fe25e0f65 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration implements-one Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "implements", + + range: [10, 20], + loc: { + start: { column: 10, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Object", + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [28, 29], + loc: { + start: { column: 28, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..b0aec089f61 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,73 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration implements-one AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [28, 30], + loc: { + start: { column: 28, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + implements: Array [ +- TSClassImplements { +- type: 'TSClassImplements', ++ TSExpressionWithTypeArguments { ++ type: 'TSExpressionWithTypeArguments', + expression: Identifier { + type: 'Identifier', + name: 'Object', + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + ], + superClass: null, + + 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/ClassDeclaration/fixtures/implements-one/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..0d56c0d096e --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/implements-one/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,72 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration implements-one AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Keyword { + type: 'Keyword', + value: 'class', + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'implements', + + range: [10, 20], + loc: { + start: { column: 10, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'Object', + + range: [21, 27], + loc: { + start: { column: 21, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [28, 29], + loc: { + start: { column: 28, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/fixture.ts new file mode 100644 index 00000000000..9a3d334adee --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/fixture.ts @@ -0,0 +1 @@ +class Foo extends Set {} diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..7fa28228017 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,115 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type-parameters TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [28, 30], + loc: { + start: { column: 28, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: Identifier { + type: "Identifier", + name: "Set", + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + superTypeParameters: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "T", + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], + + range: [24, 27], + loc: { + start: { column: 24, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + typeParameters: TSTypeParameterDeclaration { + type: "TSTypeParameterDeclaration", + params: Array [ + TSTypeParameter { + type: "TSTypeParameter", + name: Identifier { + type: "Identifier", + name: "T", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, 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/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..f73a167dba3 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,126 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type-parameters TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "extends", + + range: [13, 20], + loc: { + start: { column: 13, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Set", + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [28, 29], + loc: { + start: { column: 28, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..7c5a5149bbe --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/3-Babel-AST.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type-parameters Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [28, 30], + loc: { + start: { column: 28, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: Identifier { + type: "Identifier", + name: "Set", + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + superTypeParameters: TSTypeParameterInstantiation { + type: "TSTypeParameterInstantiation", + params: Array [ + TSTypeReference { + type: "TSTypeReference", + typeName: Identifier { + type: "Identifier", + name: "T", + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], + + range: [24, 27], + loc: { + start: { column: 24, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + typeParameters: TSTypeParameterDeclaration { + type: "TSTypeParameterDeclaration", + params: Array [ + TSTypeParameter { + type: "TSTypeParameter", + name: "T", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, 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/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..17ca652dc4a --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,126 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type-parameters Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "extends", + + range: [13, 20], + loc: { + start: { column: 13, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Set", + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [28, 29], + loc: { + start: { column: 28, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..70cae74b300 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,120 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type-parameters AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [28, 30], + loc: { + start: { column: 28, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: Identifier { + type: 'Identifier', + name: 'Set', + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + superTypeParameters: TSTypeParameterInstantiation { + type: 'TSTypeParameterInstantiation', + params: Array [ + TSTypeReference { + type: 'TSTypeReference', + typeName: Identifier { + type: 'Identifier', + name: 'T', + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], + + range: [24, 27], + loc: { + start: { column: 24, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + typeParameters: TSTypeParameterDeclaration { + type: 'TSTypeParameterDeclaration', + params: Array [ + TSTypeParameter { + type: 'TSTypeParameter', +- name: Identifier { +- type: 'Identifier', +- name: 'T', +- +- range: [10, 11], +- loc: { +- start: { column: 10, line: 1 }, +- end: { column: 11, line: 1 }, +- }, +- }, ++ name: 'T', + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, 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/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..4e5329e739f --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type-parameters AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/fixture.ts new file mode 100644 index 00000000000..9f84d173bfa --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/fixture.ts @@ -0,0 +1 @@ +class Foo {} diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..0b476f5584e --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration type-parameters TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [13, 15], + loc: { + start: { column: 13, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + typeParameters: TSTypeParameterDeclaration { + type: "TSTypeParameterDeclaration", + params: Array [ + TSTypeParameter { + type: "TSTypeParameter", + name: Identifier { + type: "Identifier", + name: "T", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 16], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..7afa2b8839b --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration type-parameters TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..de9ab22cc6b --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/3-Babel-AST.shot @@ -0,0 +1,67 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration type-parameters Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [13, 15], + loc: { + start: { column: 13, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + typeParameters: TSTypeParameterDeclaration { + type: "TSTypeParameterDeclaration", + params: Array [ + TSTypeParameter { + type: "TSTypeParameter", + name: "T", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 16], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..89bca663a6d --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration type-parameters Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "class", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..f3b75ecbb25 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,81 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration type-parameters AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [], + + range: [13, 15], + loc: { + start: { column: 13, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + typeParameters: TSTypeParameterDeclaration { + type: 'TSTypeParameterDeclaration', + params: Array [ + TSTypeParameter { + type: 'TSTypeParameter', +- name: Identifier { +- type: 'Identifier', +- name: 'T', +- +- range: [10, 11], +- loc: { +- start: { column: 10, line: 1 }, +- end: { column: 11, line: 1 }, +- }, +- }, ++ name: 'T', + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 16], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..a99d685df3d --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration type-parameters AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/fixture.ts b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/fixture.ts new file mode 100644 index 00000000000..8bab23b3599 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/fixture.ts @@ -0,0 +1 @@ +export * as 'foo' from 'module'; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..5f6d97e5f2b --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ named-non-identifier TSESTree - Error 1`] = `[TSError: Identifier expected.]`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..04ccfb73d5b --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ named-non-identifier Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..3e05e98bfaf --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ named-non-identifier Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/no-source/fixture.ts b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/no-source/fixture.ts new file mode 100644 index 00000000000..b5299226ad4 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/no-source/fixture.ts @@ -0,0 +1 @@ +export * from; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/no-source/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/no-source/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..acdaf4c735f --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/no-source/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ no-source TSESTree - Error 1`] = `[TSError: Expression expected.]`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/no-source/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/no-source/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..8bd09ace8dc --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/no-source/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ no-source Babel - Error 1`] = `[SyntaxError: Unexpected token (1:13)]`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/no-source/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/no-source/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..c2ac962baac --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/no-source/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ no-source Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/fixture.ts b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/fixture.ts new file mode 100644 index 00000000000..d78b6918cb1 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/fixture.ts @@ -0,0 +1 @@ +export * from module; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..bcf5b40695c --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ non-string-source TSESTree - Error 1`] = `[TSError: Module specifier must be a string literal.]`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..a3d08a7b52a --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ non-string-source Babel - Error 1`] = `[SyntaxError: Unexpected token (1:14)]`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..3a1a419a831 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/non-string-source/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ non-string-source Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/type-kind/fixture.ts b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/type-kind/fixture.ts new file mode 100644 index 00000000000..35e627e28c5 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/type-kind/fixture.ts @@ -0,0 +1 @@ +export type * from 'a'; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/type-kind/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/type-kind/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..a9b2c20c7fa --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/type-kind/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ type-kind TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/type-kind/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/type-kind/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..e448d4b4299 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/type-kind/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ type-kind Babel - Error 1`] = `[SyntaxError: Unexpected token (1:12)]`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/type-kind/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/type-kind/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..e9c5efb6898 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/type-kind/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ type-kind Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/fixture.ts b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/fixture.ts new file mode 100644 index 00000000000..fca392829b8 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/fixture.ts @@ -0,0 +1 @@ +export * as mod from 'module'; 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 new file mode 100644 index 00000000000..d144a119f89 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,47 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration named TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportAllDeclaration { + type: "ExportAllDeclaration", + exported: Identifier { + type: "Identifier", + name: "mod", + + 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/ExportAllDeclaration/fixtures/named/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..7fc2d67baba --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration named TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "*", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "as", + + range: [9, 11], + loc: { + start: { column: 9, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "mod", + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + String { + type: "String", + value: "'module'", + + range: [21, 29], + loc: { + start: { column: 21, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..cfda133b218 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/3-Babel-AST.shot @@ -0,0 +1,47 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration named Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportAllDeclaration { + type: "ExportAllDeclaration", + exported: Identifier { + type: "Identifier", + name: "mod", + + 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/ExportAllDeclaration/fixtures/named/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..66f249ee6ca --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration named Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "*", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "as", + + range: [9, 11], + loc: { + start: { column: 9, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "mod", + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + String { + type: "String", + value: "'module'", + + range: [21, 29], + loc: { + start: { column: 21, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..8aabbae3357 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration named AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..5020f9f630e --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration named AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/fixture.ts b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/fixture.ts new file mode 100644 index 00000000000..86a4838f7b9 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/fixture.ts @@ -0,0 +1 @@ +export * from 'my-module'; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..34d728556ef --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,38 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration unnamed TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportAllDeclaration { + type: "ExportAllDeclaration", + exported: null, + exportKind: "value", + source: Literal { + type: "Literal", + raw: "'my-module'", + value: "my-module", + + range: [14, 25], + loc: { + start: { column: 14, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..29ffb6ae0fe --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration unnamed TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "*", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [9, 13], + loc: { + start: { column: 9, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + String { + type: "String", + value: "'my-module'", + + range: [14, 25], + loc: { + start: { column: 14, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..286e180a93b --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/3-Babel-AST.shot @@ -0,0 +1,38 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration unnamed Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportAllDeclaration { + type: "ExportAllDeclaration", + exported: null, + exportKind: "value", + source: Literal { + type: "Literal", + raw: "'my-module'", + value: "my-module", + + range: [14, 25], + loc: { + start: { column: 14, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..82327ff3352 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration unnamed Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "*", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [9, 13], + loc: { + start: { column: 9, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + String { + type: "String", + value: "'my-module'", + + range: [14, 25], + loc: { + start: { column: 14, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..351bb72f34f --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration unnamed AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..e2a55391779 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration unnamed AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/fixture.ts b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/fixture.ts new file mode 100644 index 00000000000..0386d9255b0 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/fixture.ts @@ -0,0 +1 @@ +export default enum Foo {} diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..c289052b36c --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ enum TSESTree - Error 1`] = `[TSError: Expression expected.]`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..987e4dd40c8 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ enum Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:19)]`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..32a1cb0d300 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/enum/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ enum Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/fixture.ts b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/fixture.ts new file mode 100644 index 00000000000..dcefd115a28 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/fixture.ts @@ -0,0 +1 @@ +export default namespace Foo {} diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..d1633569950 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ namespace TSESTree - Error 1`] = `[TSError: ';' expected.]`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..a80c3233614 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ namespace Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:24)]`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..7ecaa9bcded --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/namespace/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ namespace Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/fixture.ts b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/fixture.ts new file mode 100644 index 00000000000..81b83c5de98 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/fixture.ts @@ -0,0 +1 @@ +export default type Foo = 1; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..bce2c7cd5ee --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ type-alias TSESTree - Error 1`] = `[TSError: ';' expected.]`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..6afc67d4a5b --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ type-alias Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:19)]`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..9f4c01a0337 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/type-alias/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ type-alias Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/fixture.ts b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/fixture.ts new file mode 100644 index 00000000000..4b535f12615 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/fixture.ts @@ -0,0 +1 @@ +export default const x = 1; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..43ab9a3893e --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ variable-declaration TSESTree - Error 1`] = `[TSError: Expression expected.]`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..318dee3aacf --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ variable-declaration Babel - Error 1`] = `[SyntaxError: Only expressions, functions or classes are allowed as the \`default\` export. (1:15)]`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..327cd763562 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/_error_/variable-declaration/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration _error_ variable-declaration Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/fixture.ts b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/fixture.ts new file mode 100644 index 00000000000..a6e68e98389 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/fixture.ts @@ -0,0 +1 @@ +export default class {} 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 new file mode 100644 index 00000000000..bc5b9ffa8c1 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,47 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration anonymous-class TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportDefaultDeclaration { + type: "ExportDefaultDeclaration", + declaration: ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + id: null, + 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-class/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..9773e0f17a9 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration anonymous-class TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "default", + + range: [7, 14], + loc: { + start: { column: 7, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [15, 20], + loc: { + start: { column: 15, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..1262745aead --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/3-Babel-AST.shot @@ -0,0 +1,47 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration anonymous-class Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportDefaultDeclaration { + type: "ExportDefaultDeclaration", + declaration: ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + id: null, + 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-class/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..74d6f62864b --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration anonymous-class Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "default", + + range: [7, 14], + loc: { + start: { column: 7, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [15, 20], + loc: { + start: { column: 15, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..6c617458733 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration anonymous-class AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..7ace7535964 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-class/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration anonymous-class AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/fixture.ts b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/fixture.ts new file mode 100644 index 00000000000..ea9b101e1c2 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/fixture.ts @@ -0,0 +1 @@ +export default function () {} 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 new file mode 100644 index 00000000000..e30c973e4c5 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,50 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration anonymous-function TSESTree - AST 1`] = ` +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 }, + }, + }, + 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/anonymous-function/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..292689734d6 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration anonymous-function TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "default", + + range: [7, 14], + loc: { + start: { column: 7, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "function", + + range: [15, 23], + loc: { + start: { column: 15, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [28, 29], + loc: { + start: { column: 28, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..d379b69f6c4 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/3-Babel-AST.shot @@ -0,0 +1,50 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration anonymous-function Babel - AST 1`] = ` +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 }, + }, + }, + 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/anonymous-function/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..b52b674b4d5 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration anonymous-function Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "default", + + range: [7, 14], + loc: { + start: { column: 7, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "function", + + range: [15, 23], + loc: { + start: { column: 15, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [28, 29], + loc: { + start: { column: 28, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..0472fbccb82 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration anonymous-function AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..9b1f36f4e1e --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/anonymous-function/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration anonymous-function AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/fixture.ts b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/fixture.ts new file mode 100644 index 00000000000..2d1ec238274 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/fixture.ts @@ -0,0 +1 @@ +export default () => {}; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..d4ccafd5b51 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,50 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration arrow-function-expression TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportDefaultDeclaration { + type: "ExportDefaultDeclaration", + declaration: ArrowFunctionExpression { + type: "ArrowFunctionExpression", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: Array [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + expression: false, + generator: false, + id: null, + params: Array [], + + range: [15, 23], + loc: { + start: { column: 15, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + exportKind: "value", + + 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/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..b49305998ff --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration arrow-function-expression TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "default", + + range: [7, 14], + loc: { + start: { column: 7, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=>", + + range: [18, 20], + loc: { + start: { column: 18, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [23, 24], + loc: { + start: { column: 23, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..85a0d39624f --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/3-Babel-AST.shot @@ -0,0 +1,50 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration arrow-function-expression Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportDefaultDeclaration { + type: "ExportDefaultDeclaration", + declaration: ArrowFunctionExpression { + type: "ArrowFunctionExpression", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: Array [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + expression: false, + generator: false, + id: null, + params: Array [], + + range: [15, 23], + loc: { + start: { column: 15, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + exportKind: "value", + + 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/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..fc7a2baf088 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration arrow-function-expression Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "default", + + range: [7, 14], + loc: { + start: { column: 7, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=>", + + range: [18, 20], + loc: { + start: { column: 18, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [23, 24], + loc: { + start: { column: 23, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..359c33602be --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration arrow-function-expression AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..c7f2151c920 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/arrow-function-expression/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration arrow-function-expression AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/fixture.ts b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/fixture.ts new file mode 100644 index 00000000000..caaf4f896e8 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/fixture.ts @@ -0,0 +1 @@ +export default (class Foo {}); 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 new file mode 100644 index 00000000000..166a1d77c3d --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration class-expression TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportDefaultDeclaration { + type: "ExportDefaultDeclaration", + declaration: ClassExpression { + type: "ClassExpression", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [26, 28], + loc: { + start: { column: 26, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [22, 25], + loc: { + start: { column: 22, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + 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-expression/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..4e62aa0dc6a --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration class-expression TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "default", + + range: [7, 14], + loc: { + start: { column: 7, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [16, 21], + loc: { + start: { column: 16, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [22, 25], + loc: { + start: { column: 22, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [28, 29], + loc: { + start: { column: 28, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..25ab06d87ef --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/3-Babel-AST.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration class-expression Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportDefaultDeclaration { + type: "ExportDefaultDeclaration", + declaration: ClassExpression { + type: "ClassExpression", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [26, 28], + loc: { + start: { column: 26, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [22, 25], + loc: { + start: { column: 22, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + 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-expression/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..4137a875c9f --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration class-expression Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "default", + + range: [7, 14], + loc: { + start: { column: 7, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [16, 21], + loc: { + start: { column: 16, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [22, 25], + loc: { + start: { column: 22, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [28, 29], + loc: { + start: { column: 28, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..4d3dd269c49 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration class-expression AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..1328ba27a28 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class-expression/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration class-expression AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/fixture.ts b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/fixture.ts new file mode 100644 index 00000000000..7804111002d --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/fixture.ts @@ -0,0 +1 @@ +export default class Foo {} 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 new file mode 100644 index 00000000000..f2ce271ea77 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration class TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportDefaultDeclaration { + type: "ExportDefaultDeclaration", + declaration: ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [25, 27], + loc: { + start: { column: 25, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + 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/class/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..5703d446ea5 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration class TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "default", + + range: [7, 14], + loc: { + start: { column: 7, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [15, 20], + loc: { + start: { column: 15, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..432ded44307 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/3-Babel-AST.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration class Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportDefaultDeclaration { + type: "ExportDefaultDeclaration", + declaration: ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [25, 27], + loc: { + start: { column: 25, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + 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/class/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..01f9049584e --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration class Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "default", + + range: [7, 14], + loc: { + start: { column: 7, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [15, 20], + loc: { + start: { column: 15, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [21, 24], + loc: { + start: { column: 21, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [25, 26], + loc: { + start: { column: 25, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..892ae8987da --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration class AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..96e9c654eee --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/class/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration class AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/fixture.ts b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/fixture.ts new file mode 100644 index 00000000000..386baca1731 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/fixture.ts @@ -0,0 +1 @@ +export default function foo() {} 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 new file mode 100644 index 00000000000..59570dbd56d --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,59 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration function TSESTree - AST 1`] = ` +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 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + 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/function/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..b3a2cd2b15b --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration function TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "default", + + range: [7, 14], + loc: { + start: { column: 7, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "function", + + range: [15, 23], + loc: { + start: { column: 15, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [24, 27], + loc: { + start: { column: 24, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [28, 29], + loc: { + start: { column: 28, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [31, 32], + loc: { + start: { column: 31, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..98b11432232 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/3-Babel-AST.shot @@ -0,0 +1,59 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration function Babel - AST 1`] = ` +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 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + 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/function/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..44f7cd272d3 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration function Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "default", + + range: [7, 14], + loc: { + start: { column: 7, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "function", + + range: [15, 23], + loc: { + start: { column: 15, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [24, 27], + loc: { + start: { column: 24, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [28, 29], + loc: { + start: { column: 28, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [31, 32], + loc: { + start: { column: 31, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..6e67c16fb8b --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration function AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..b5de7325dea --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/function/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration function AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/fixture.ts b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/fixture.ts new file mode 100644 index 00000000000..7b56c8b8f39 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/fixture.ts @@ -0,0 +1 @@ +export default x; 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 new file mode 100644 index 00000000000..11900ab6838 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration identifier TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportDefaultDeclaration { + type: "ExportDefaultDeclaration", + declaration: Identifier { + type: "Identifier", + name: "x", + + 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/identifier/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..d52ccbb0406 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration identifier TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "default", + + range: [7, 14], + loc: { + start: { column: 7, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..be4bb919b88 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/3-Babel-AST.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration identifier Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportDefaultDeclaration { + type: "ExportDefaultDeclaration", + declaration: Identifier { + type: "Identifier", + name: "x", + + 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/identifier/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..e4567a57c93 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration identifier Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "default", + + range: [7, 14], + loc: { + start: { column: 7, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..1fc84e1257d --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration identifier AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..fa730c9cc1d --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/identifier/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration identifier AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/fixture.ts b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/fixture.ts new file mode 100644 index 00000000000..4c36019eea2 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/fixture.ts @@ -0,0 +1 @@ +export default interface Foo {} 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 new file mode 100644 index 00000000000..755e1480fde --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,55 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration interface TSESTree - AST 1`] = ` +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 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + 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/ExportDefaultDeclaration/fixtures/interface/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..e528391c3b1 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration interface TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "default", + + range: [7, 14], + loc: { + start: { column: 7, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "interface", + + range: [15, 24], + loc: { + start: { column: 15, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [25, 28], + loc: { + start: { column: 25, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..2619c1ffa78 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/3-Babel-AST.shot @@ -0,0 +1,55 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration interface Babel - AST 1`] = ` +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 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + 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/ExportDefaultDeclaration/fixtures/interface/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..9363ba0a28b --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration interface Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "default", + + range: [7, 14], + loc: { + start: { column: 7, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "interface", + + range: [15, 24], + loc: { + start: { column: 15, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [25, 28], + loc: { + start: { column: 25, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..778b30b1513 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration interface AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..e0918e2af4e --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/interface/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,72 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration interface AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Keyword { + type: 'Keyword', + value: 'export', + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: 'Keyword', + value: 'default', + + range: [7, 14], + loc: { + start: { column: 7, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'interface', + + range: [15, 24], + loc: { + start: { column: 15, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'Foo', + + range: [25, 28], + loc: { + start: { column: 25, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [30, 31], + loc: { + start: { column: 30, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/fixture.ts b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/fixture.ts new file mode 100644 index 00000000000..aef22247d75 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/fixture.ts @@ -0,0 +1 @@ +export default 1; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/1-TSESTree-AST.shot new file mode 100644 index 00000000000..dae455b793b --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,37 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration literal TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportDefaultDeclaration { + type: "ExportDefaultDeclaration", + declaration: Literal { + type: "Literal", + raw: "1", + value: 1, + + 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/literal/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..48eaeb62600 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration literal TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "default", + + range: [7, 14], + loc: { + start: { column: 7, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..f4c959e63f2 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/3-Babel-AST.shot @@ -0,0 +1,37 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration literal Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportDefaultDeclaration { + type: "ExportDefaultDeclaration", + declaration: Literal { + type: "Literal", + raw: "1", + value: 1, + + 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/literal/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..209d1dbb63f --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration literal Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "default", + + range: [7, 14], + loc: { + start: { column: 7, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 00000000000..7715558acb1 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration literal AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..c0a93423d4d --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/fixtures/literal/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportDefaultDeclaration literal AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/spec.ts b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/spec.ts index 492d0981b8c..2cfe1cce5b3 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/spec.ts @@ -6,6 +6,10 @@ import type { ExportKind } from '../ExportAndImportKind'; export interface ExportDefaultDeclaration extends BaseNode { type: AST_NODE_TYPES.ExportDefaultDeclaration; - declaration: ExportDeclaration | Expression; + declaration: + | // TODO(error handling) - the following are disallowed syntactically, but allowed by TS error recovery: + // TSEnumDeclaration, TSModuleDeclaration, TSTypeAliasDeclaration, VariableDeclaration + ExportDeclaration + | Expression; exportKind: ExportKind; } diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/fixture.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/fixture.ts new file mode 100644 index 00000000000..5faf31b8867 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/fixture.ts @@ -0,0 +1 @@ +export { a as 'a' }; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..71841045f6c --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ aliased-literal TSESTree - Error 1`] = `[TSError: Identifier expected.]`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..dabc7d927d5 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ aliased-literal Babel - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..efb97399842 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ aliased-literal Error Alignment 1`] = `"TSESTree errored but Babel didn't"`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/fixture.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/fixture.ts new file mode 100644 index 00000000000..c433d66cf64 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/fixture.ts @@ -0,0 +1 @@ +export class {} diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..4bb37139b1b --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ anonymous-class TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..b3ebe67f29a --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ anonymous-class Babel - Error 1`] = `[SyntaxError: A class name is required. (1:13)]`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..82e5ade4750 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ anonymous-class Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/fixture.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/fixture.ts new file mode 100644 index 00000000000..d9a2010f925 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/fixture.ts @@ -0,0 +1 @@ +export function () {} diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..9c89f7d7f37 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ anonymous-function-expression TSESTree - Error 1`] = `[TSError: Identifier expected.]`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..70ef1140faa --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ anonymous-function-expression Babel - Error 1`] = `[SyntaxError: Unexpected token (1:16)]`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..15aae2856e1 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-function-expression/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ anonymous-function-expression Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/fixture.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/fixture.ts new file mode 100644 index 00000000000..ec7e7945aaf --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/fixture.ts @@ -0,0 +1 @@ +export () => {}; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..bc1507d797f --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ arrow-function TSESTree - Error 1`] = `[TSError: Declaration or statement expected.]`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..d3a01941b96 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ arrow-function Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:7)]`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..fd6445ddef3 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/arrow-function/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ arrow-function Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/fixture.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/fixture.ts new file mode 100644 index 00000000000..bb46c3698b9 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/fixture.ts @@ -0,0 +1 @@ +export (class Foo {}); diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..af9eba5ac2c --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ class-expression TSESTree - Error 1`] = `[TSError: Declaration or statement expected.]`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..59d790cb18d --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ class-expression Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:7)]`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..dbe6913aab5 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/class-expression/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ class-expression Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/fixture.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/fixture.ts new file mode 100644 index 00000000000..0d3d77ac413 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/fixture.ts @@ -0,0 +1 @@ +export a; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..302c6c7c652 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ identifier-direct TSESTree - Error 1`] = `[TSError: Declaration or statement expected.]`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..968987af209 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ identifier-direct Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:7)]`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..00f60c625f5 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/identifier-direct/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ identifier-direct Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/fixture.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/fixture.ts new file mode 100644 index 00000000000..7eec000d816 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/fixture.ts @@ -0,0 +1 @@ +export { 'a' }; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..7e7d8c008fc --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ literal-braced TSESTree - Error 1`] = `[TSError: Identifier expected.]`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..3ba27489473 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/2-Babel-Error.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ literal-braced Babel - Error 1`] = ` +[SyntaxError: A string literal cannot be used as an exported binding without \`from\`. +- Did you mean \`export { 'a' as 'a' } from 'some-module'\`? (1:9)] +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..f2d4bb40cc5 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-braced/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ literal-braced Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/fixture.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/fixture.ts new file mode 100644 index 00000000000..ed5896524bf --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/fixture.ts @@ -0,0 +1 @@ +export 'a'; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/1-TSESTree-Error.shot new file mode 100644 index 00000000000..9e96ac05522 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ literal-direct TSESTree - Error 1`] = `[TSError: Declaration or statement expected.]`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/2-Babel-Error.shot new file mode 100644 index 00000000000..cf5a26409d1 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ literal-direct Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:7)]`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/3-Alignment-Error.shot new file mode 100644 index 00000000000..7d06f41fc05 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/_error_/literal-direct/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration _error_ literal-direct Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/fixture.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/fixture.ts new file mode 100644 index 00000000000..060ae5187cf --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/fixture.ts @@ -0,0 +1 @@ +export { a as b }; 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 new file mode 100644 index 00000000000..951a52a70f1 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,59 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration aliased TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + declaration: null, + exportKind: "value", + source: null, + specifiers: Array [ + ExportSpecifier { + type: "ExportSpecifier", + exported: Identifier { + type: "Identifier", + name: "b", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + local: Identifier { + type: "Identifier", + name: "a", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [9, 15], + loc: { + start: { column: 9, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + ], + + 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/aliased/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..24df13756b8 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration aliased TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "as", + + range: [11, 13], + loc: { + start: { column: 11, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "b", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..82c3dfdcd6a --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/3-Babel-AST.shot @@ -0,0 +1,59 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration aliased Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + declaration: null, + exportKind: "value", + source: null, + specifiers: Array [ + ExportSpecifier { + type: "ExportSpecifier", + exported: Identifier { + type: "Identifier", + name: "b", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + local: Identifier { + type: "Identifier", + name: "a", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [9, 15], + loc: { + start: { column: 9, line: 1 }, + end: { column: 15, 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/ExportNamedDeclaration/fixtures/aliased/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..bce9dd071b1 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration aliased Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "as", + + range: [11, 13], + loc: { + start: { column: 11, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "b", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..c47e8452bb0 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,64 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration aliased AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + declaration: null, + exportKind: 'value', + source: null, + specifiers: Array [ + ExportSpecifier { + type: 'ExportSpecifier', + exported: Identifier { + type: 'Identifier', + name: 'b', + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + local: Identifier { + type: 'Identifier', + name: 'a', + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [9, 15], + loc: { + start: { column: 9, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + ], + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], +- sourceType: 'module', ++ sourceType: 'script', + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..ce523723d51 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration aliased AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/fixture.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/fixture.ts new file mode 100644 index 00000000000..223d0a8b395 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/fixture.ts @@ -0,0 +1 @@ +export class Foo {} 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 new file mode 100644 index 00000000000..78ca8f0f95b --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,58 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration class TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + declaration: ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [17, 19], + loc: { + start: { column: 17, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [13, 16], + loc: { + start: { column: 13, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + 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/class/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..b9218046a08 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration class TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [7, 12], + loc: { + start: { column: 7, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [13, 16], + loc: { + start: { column: 13, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..7041dd9e2cf --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/3-Babel-AST.shot @@ -0,0 +1,58 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration class Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + declaration: ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [], + + range: [17, 19], + loc: { + start: { column: 17, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [13, 16], + loc: { + start: { column: 13, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + 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/class/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..cdfb7afcd34 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration class Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "class", + + range: [7, 12], + loc: { + start: { column: 7, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [13, 16], + loc: { + start: { column: 13, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..cb90ab5e0fb --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration class AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..8f68d87f732 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration class AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/fixture.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/fixture.ts new file mode 100644 index 00000000000..b1725174a5e --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/fixture.ts @@ -0,0 +1 @@ +export declare function foo(): void; 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 new file mode 100644 index 00000000000..f64e471ca14 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,70 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration declare-function TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + declaration: TSDeclareFunction { + type: "TSDeclareFunction", + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [24, 27], + loc: { + start: { column: 24, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + params: Array [], + returnType: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSVoidKeyword { + type: "TSVoidKeyword", + + range: [31, 35], + loc: { + start: { column: 31, line: 1 }, + end: { column: 35, line: 1 }, + }, + }, + + range: [29, 35], + loc: { + start: { column: 29, line: 1 }, + end: { column: 35, line: 1 }, + }, + }, + + range: [7, 36], + loc: { + start: { column: 7, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + exportKind: "type", + source: null, + specifiers: Array [], + + range: [0, 36], + loc: { + start: { column: 0, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 37], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..13073c0479d --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration declare-function TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "declare", + + range: [7, 14], + loc: { + start: { column: 7, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "function", + + range: [15, 23], + loc: { + start: { column: 15, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [24, 27], + loc: { + start: { column: 24, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [28, 29], + loc: { + start: { column: 28, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "void", + + range: [31, 35], + loc: { + start: { column: 31, line: 1 }, + end: { column: 35, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [35, 36], + loc: { + start: { column: 35, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..393d84cb152 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/3-Babel-AST.shot @@ -0,0 +1,70 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration declare-function Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + declaration: TSDeclareFunction { + type: "TSDeclareFunction", + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [24, 27], + loc: { + start: { column: 24, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + params: Array [], + returnType: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSVoidKeyword { + type: "TSVoidKeyword", + + range: [31, 35], + loc: { + start: { column: 31, line: 1 }, + end: { column: 35, line: 1 }, + }, + }, + + range: [29, 35], + loc: { + start: { column: 29, line: 1 }, + end: { column: 35, line: 1 }, + }, + }, + + range: [7, 36], + loc: { + start: { column: 7, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + exportKind: "type", + source: null, + specifiers: Array [], + + range: [0, 36], + loc: { + start: { column: 0, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 37], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..b5ea9d5fbf4 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration declare-function Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "declare", + + range: [7, 14], + loc: { + start: { column: 7, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "function", + + range: [15, 23], + loc: { + start: { column: 15, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [24, 27], + loc: { + start: { column: 24, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [28, 29], + loc: { + start: { column: 28, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [29, 30], + loc: { + start: { column: 29, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "void", + + range: [31, 35], + loc: { + start: { column: 31, line: 1 }, + end: { column: 35, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [35, 36], + loc: { + start: { column: 35, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..747cc98291f --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,75 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration declare-function AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + declaration: TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', + name: 'foo', + + range: [24, 27], + loc: { + start: { column: 24, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + params: Array [], + returnType: TSTypeAnnotation { + type: 'TSTypeAnnotation', + typeAnnotation: TSVoidKeyword { + type: 'TSVoidKeyword', + + range: [31, 35], + loc: { + start: { column: 31, line: 1 }, + end: { column: 35, line: 1 }, + }, + }, + + range: [29, 35], + loc: { + start: { column: 29, line: 1 }, + end: { column: 35, line: 1 }, + }, + }, + + range: [7, 36], + loc: { + start: { column: 7, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + exportKind: 'type', + source: null, + specifiers: Array [], + + range: [0, 36], + loc: { + start: { column: 0, line: 1 }, + end: { column: 36, line: 1 }, + }, + }, + ], +- sourceType: 'module', ++ sourceType: 'script', + + range: [0, 37], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..9b1647311bd --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration declare-function AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/fixture.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/fixture.ts new file mode 100644 index 00000000000..3705c4fd946 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/fixture.ts @@ -0,0 +1 @@ +export enum Foo {} 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 new file mode 100644 index 00000000000..71e411c31b7 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,48 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration enum TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + declaration: TSEnumDeclaration { + type: "TSEnumDeclaration", + id: Identifier { + type: "Identifier", + name: "Foo", + + 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/enum/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..5c6e73d4b25 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration enum TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "enum", + + range: [7, 11], + loc: { + start: { column: 7, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..6dafb943f57 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/3-Babel-AST.shot @@ -0,0 +1,48 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration enum Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + declaration: TSEnumDeclaration { + type: "TSEnumDeclaration", + id: Identifier { + type: "Identifier", + name: "Foo", + + 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/enum/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..e7ad15b4a50 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration enum Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "enum", + + range: [7, 11], + loc: { + start: { column: 7, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..1a21129afb2 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration enum AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..2d3cd94a36c --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration enum AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Keyword { + type: 'Keyword', + value: 'export', + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'enum', + + range: [7, 11], + loc: { + start: { column: 7, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'Foo', + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/fixture.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/fixture.ts new file mode 100644 index 00000000000..f99d4277774 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/fixture.ts @@ -0,0 +1 @@ +export function foo() {} 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 new file mode 100644 index 00000000000..5f75ef24847 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,61 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration function-declaration TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + 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 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + 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/function-declaration/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..c4c9340ff8c --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration function-declaration TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "function", + + range: [7, 15], + loc: { + start: { column: 7, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [23, 24], + loc: { + start: { column: 23, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..f5759a789a3 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/3-Babel-AST.shot @@ -0,0 +1,61 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration function-declaration Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + 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 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + 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/function-declaration/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..f60ad2056b0 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration function-declaration Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "function", + + range: [7, 15], + loc: { + start: { column: 7, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [16, 19], + loc: { + start: { column: 16, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "(", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ")", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [23, 24], + loc: { + start: { column: 23, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..fe318b3ed6f --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration function-declaration AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..502fe958a40 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration function-declaration AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/fixture.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/fixture.ts new file mode 100644 index 00000000000..7e905f38bf5 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/fixture.ts @@ -0,0 +1 @@ +export { a }; 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 new file mode 100644 index 00000000000..4f74a14c10d --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,59 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration identifier-braced TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + declaration: null, + exportKind: "value", + source: null, + specifiers: Array [ + ExportSpecifier { + type: "ExportSpecifier", + exported: Identifier { + type: "Identifier", + name: "a", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + local: Identifier { + type: "Identifier", + name: "a", + + 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, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..471a1862f6c --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration identifier-braced TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..d273070078d --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/3-Babel-AST.shot @@ -0,0 +1,59 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration identifier-braced Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + declaration: null, + exportKind: "value", + source: null, + specifiers: Array [ + ExportSpecifier { + type: "ExportSpecifier", + exported: Identifier { + type: "Identifier", + name: "a", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + local: Identifier { + type: "Identifier", + name: "a", + + 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, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..c01ed8b93a4 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration identifier-braced Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..7c15286e575 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,64 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration identifier-braced AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + declaration: null, + exportKind: 'value', + source: null, + specifiers: Array [ + ExportSpecifier { + type: 'ExportSpecifier', + exported: Identifier { + type: 'Identifier', + name: 'a', + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + local: Identifier { + type: 'Identifier', + name: 'a', + + 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, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], +- sourceType: 'module', ++ sourceType: 'script', + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..d3563662f8c --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration identifier-braced AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/fixture.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/fixture.ts new file mode 100644 index 00000000000..606432a162a --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/fixture.ts @@ -0,0 +1 @@ +export { a, b }; 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 new file mode 100644 index 00000000000..370ae6439e1 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration identifier-many TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + declaration: null, + exportKind: "value", + source: null, + specifiers: Array [ + ExportSpecifier { + type: "ExportSpecifier", + exported: Identifier { + type: "Identifier", + name: "a", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + local: Identifier { + type: "Identifier", + name: "a", + + 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 }, + }, + }, + ExportSpecifier { + type: "ExportSpecifier", + exported: Identifier { + type: "Identifier", + name: "b", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + local: Identifier { + type: "Identifier", + name: "b", + + 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, 16], + loc: { + start: { column: 0, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..91bf0e7c2b9 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration identifier-many TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "b", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..2dd893ac711 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/3-Babel-AST.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration identifier-many Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + declaration: null, + exportKind: "value", + source: null, + specifiers: Array [ + ExportSpecifier { + type: "ExportSpecifier", + exported: Identifier { + type: "Identifier", + name: "a", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + local: Identifier { + type: "Identifier", + name: "a", + + 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 }, + }, + }, + ExportSpecifier { + type: "ExportSpecifier", + exported: Identifier { + type: "Identifier", + name: "b", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + local: Identifier { + type: "Identifier", + name: "b", + + 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, 16], + loc: { + start: { column: 0, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..f29165c63d0 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration identifier-many Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "b", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..fd763b3d634 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,93 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration identifier-many AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + declaration: null, + exportKind: 'value', + source: null, + specifiers: Array [ + ExportSpecifier { + type: 'ExportSpecifier', + exported: Identifier { + type: 'Identifier', + name: 'a', + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + local: Identifier { + type: 'Identifier', + name: 'a', + + 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 }, + }, + }, + ExportSpecifier { + type: 'ExportSpecifier', + exported: Identifier { + type: 'Identifier', + name: 'b', + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + local: Identifier { + type: 'Identifier', + name: 'b', + + 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, 16], + loc: { + start: { column: 0, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], +- sourceType: 'module', ++ sourceType: 'script', + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..939b36fc37c --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration identifier-many AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/fixture.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/fixture.ts new file mode 100644 index 00000000000..39df3b83f7e --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/fixture.ts @@ -0,0 +1 @@ +export interface Foo {} 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 new file mode 100644 index 00000000000..a9888863f9c --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,57 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration interface TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + declaration: TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: Array [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [7, 23], + loc: { + start: { column: 7, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + exportKind: "type", + source: null, + specifiers: Array [], + + 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/ExportNamedDeclaration/fixtures/interface/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..9a0b5ef7598 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration interface TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "interface", + + range: [7, 16], + loc: { + start: { column: 7, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..36a4cac831a --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/3-Babel-AST.shot @@ -0,0 +1,57 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration interface Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + declaration: TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: Array [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [7, 23], + loc: { + start: { column: 7, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + exportKind: "type", + source: null, + specifiers: 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/ExportNamedDeclaration/fixtures/interface/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..c52d2829e2e --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration interface Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "interface", + + range: [7, 16], + loc: { + start: { column: 7, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..119f2651036 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration interface AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + declaration: TSInterfaceDeclaration { + type: 'TSInterfaceDeclaration', + body: TSInterfaceBody { + type: 'TSInterfaceBody', + body: Array [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [7, 23], + loc: { + start: { column: 7, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + exportKind: 'type', + source: null, + specifiers: Array [], + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], +- sourceType: 'module', ++ sourceType: 'script', + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..3bf1141ae94 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration interface AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Keyword { + type: 'Keyword', + value: 'export', + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'interface', + + range: [7, 16], + loc: { + start: { column: 7, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'Foo', + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/fixture.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/fixture.ts new file mode 100644 index 00000000000..851030bd028 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/fixture.ts @@ -0,0 +1 @@ +export namespace Foo {} 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 new file mode 100644 index 00000000000..00a9c9d6270 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,57 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration namespace TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + declaration: TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [7, 23], + loc: { + start: { column: 7, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + exportKind: "value", + source: null, + specifiers: Array [], + + 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/ExportNamedDeclaration/fixtures/namespace/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..72df88433a4 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration namespace TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "namespace", + + range: [7, 16], + loc: { + start: { column: 7, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..4a726419a21 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/3-Babel-AST.shot @@ -0,0 +1,57 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration namespace Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + declaration: TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [7, 23], + loc: { + start: { column: 7, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + exportKind: "value", + source: null, + specifiers: Array [], + + 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/ExportNamedDeclaration/fixtures/namespace/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..0a3d1ca1dee --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration namespace Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "namespace", + + range: [7, 16], + loc: { + start: { column: 7, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..00a19c01c58 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration namespace AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..57daa643d18 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration namespace AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/fixture.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/fixture.ts new file mode 100644 index 00000000000..f29cc6f5296 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/fixture.ts @@ -0,0 +1 @@ +export type A = 1; 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 new file mode 100644 index 00000000000..034591c40b3 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,67 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration type-alias TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + declaration: TSTypeAliasDeclaration { + type: "TSTypeAliasDeclaration", + id: Identifier { + type: "Identifier", + name: "A", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + typeAnnotation: TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [7, 18], + loc: { + start: { column: 7, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + exportKind: "type", + 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/type-alias/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..b7fb84a7c81 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration type-alias TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "type", + + range: [7, 11], + loc: { + start: { column: 7, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "A", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..f46cb4220c3 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/3-Babel-AST.shot @@ -0,0 +1,67 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration type-alias Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + declaration: TSTypeAliasDeclaration { + type: "TSTypeAliasDeclaration", + id: Identifier { + type: "Identifier", + name: "A", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + typeAnnotation: TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [7, 18], + loc: { + start: { column: 7, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + exportKind: "type", + source: null, + specifiers: 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/ExportNamedDeclaration/fixtures/type-alias/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..597a4d5f2bd --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration type-alias Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "type", + + range: [7, 11], + loc: { + start: { column: 7, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "A", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..6a23dbc46ed --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,72 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration type-alias AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ExportNamedDeclaration { + type: 'ExportNamedDeclaration', + declaration: TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', + id: Identifier { + type: 'Identifier', + name: 'A', + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + + range: [7, 18], + loc: { + start: { column: 7, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + exportKind: 'type', + source: null, + specifiers: Array [], + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], +- sourceType: 'module', ++ sourceType: 'script', + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..6f04a9a6981 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration type-alias AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/fixture.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/fixture.ts new file mode 100644 index 00000000000..ad1d380d6cc --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/fixture.ts @@ -0,0 +1 @@ +export const x = 1; 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 new file mode 100644 index 00000000000..ab30bcebe79 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,70 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration variable-declaration TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + declaration: VariableDeclaration { + type: "VariableDeclaration", + declarations: Array [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + 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 }, + }, + }, + ], + 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/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 00000000000..73bd6c93bb9 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration variable-declaration TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [7, 12], + loc: { + start: { column: 7, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/3-Babel-AST.shot new file mode 100644 index 00000000000..481e1f85b7d --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/3-Babel-AST.shot @@ -0,0 +1,70 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration variable-declaration Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + declaration: VariableDeclaration { + type: "VariableDeclaration", + declarations: Array [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + 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 }, + }, + }, + ], + 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/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/4-Babel-Tokens.shot new file mode 100644 index 00000000000..1bfff47fa92 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration variable-declaration Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "export", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "const", + + range: [7, 12], + loc: { + start: { column: 7, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, +] +`; 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 new file mode 100644 index 00000000000..bb45021e9c4 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration variable-declaration AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 00000000000..de15dbc1cc6 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration variable-declaration AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts index b4347142809..09f584ef975 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts @@ -7,6 +7,7 @@ import type { ExportKind } from '../ExportAndImportKind'; export interface ExportNamedDeclaration extends BaseNode { type: AST_NODE_TYPES.ExportNamedDeclaration; + // TODO(error handling) - ClassExpression is not valid here declaration: ExportDeclaration | null; specifiers: ExportSpecifier[]; source: StringLiteral | null; diff --git a/packages/ast-spec/tests/PunctuatorTokenToText.test.ts b/packages/ast-spec/tests/PunctuatorTokenToText.type-test.ts similarity index 100% rename from packages/ast-spec/tests/PunctuatorTokenToText.test.ts rename to packages/ast-spec/tests/PunctuatorTokenToText.type-test.ts diff --git a/packages/ast-spec/tests/ast-node-types.test.ts b/packages/ast-spec/tests/ast-node-types.type-test.ts similarity index 100% rename from packages/ast-spec/tests/ast-node-types.test.ts rename to packages/ast-spec/tests/ast-node-types.type-test.ts diff --git a/packages/ast-spec/tests/fixtures-with-differences-ast.shot b/packages/ast-spec/tests/fixtures-with-differences-ast.shot new file mode 100644 index 00000000000..2a37d6b6582 --- /dev/null +++ b/packages/ast-spec/tests/fixtures-with-differences-ast.shot @@ -0,0 +1,16 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures List fixtures with AST differences 1`] = ` +Set { + "declaration/ClassDeclaration/fixtures/implements-many/fixture.ts", + "declaration/ClassDeclaration/fixtures/implements-one/fixture.ts", + "declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/fixture.ts", + "declaration/ClassDeclaration/fixtures/type-parameters/fixture.ts", + "declaration/ExportNamedDeclaration/fixtures/aliased/fixture.ts", + "declaration/ExportNamedDeclaration/fixtures/declare-function/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/type-alias/fixture.ts", +} +`; diff --git a/packages/ast-spec/tests/fixtures-with-differences-errors.shot b/packages/ast-spec/tests/fixtures-with-differences-errors.shot new file mode 100644 index 00000000000..59b5c479a75 --- /dev/null +++ b/packages/ast-spec/tests/fixtures-with-differences-errors.shot @@ -0,0 +1,15 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures List fixtures with Error differences 1`] = ` +Object { + "Babel errored but TSESTree didn't": Set { + "declaration/ClassDeclaration/fixtures/_error_/implements-non-identifier/fixture.ts", + "declaration/ExportAllDeclaration/fixtures/_error_/type-kind/fixture.ts", + "declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/fixture.ts", + }, + "TSESTree errored but Babel didn't": Set { + "declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/fixture.ts", + "declaration/ExportNamedDeclaration/fixtures/_error_/aliased-literal/fixture.ts", + }, +} +`; diff --git a/packages/ast-spec/tests/fixtures-with-differences-tokens.shot b/packages/ast-spec/tests/fixtures-with-differences-tokens.shot new file mode 100644 index 00000000000..6c8d721a41a --- /dev/null +++ b/packages/ast-spec/tests/fixtures-with-differences-tokens.shot @@ -0,0 +1,11 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures List fixtures with Token differences 1`] = ` +Set { + "declaration/ClassDeclaration/fixtures/implements-many/fixture.ts", + "declaration/ClassDeclaration/fixtures/implements-one/fixture.ts", + "declaration/ExportDefaultDeclaration/fixtures/interface/fixture.ts", + "declaration/ExportNamedDeclaration/fixtures/enum/fixture.ts", + "declaration/ExportNamedDeclaration/fixtures/interface/fixture.ts", +} +`; diff --git a/packages/ast-spec/tests/fixtures.test.ts b/packages/ast-spec/tests/fixtures.test.ts new file mode 100644 index 00000000000..095c4179073 --- /dev/null +++ b/packages/ast-spec/tests/fixtures.test.ts @@ -0,0 +1,230 @@ +import fs from 'fs'; +import glob from 'glob'; +import makeDir from 'make-dir'; +import path from 'path'; +import { parseBabel } from './util/parsers/babel'; +import { Fixture } from './util/parsers/parser-types'; +import { parseTSESTree } from './util/parsers/typescript-estree'; +import { snapshotDiff, diffHasChanges } from './util/snapshot-diff'; + +const PACKAGE_ROOT = path.resolve(__dirname, '..'); +const SRC_DIR = path.resolve(PACKAGE_ROOT, 'src'); + +// Assign a segment set to this variable to limit the test to only this segment +// This is super helpful if you need to debug why a specific fixture isn't producing the correct output +// eg. ['declaration', 'ClassDeclaration', 'abstract'] will only test /declaration/ClassDeclaration/fixtures/abstract/fixture.ts +// prettier-ignore +const ONLY = [].join(path.sep); + +const fixturesWithASTDifferences = new Set(); +const fixturesWithTokenDifferences = new Set(); +enum ErrorLabel { + TSESTree = "TSESTree errored but Babel didn't", + Babel = "Babel errored but TSESTree didn't", + Both = 'Both errored', + None = 'No errors', +} +const fixturesWithErrorDifferences = { + [ErrorLabel.TSESTree]: new Set(), + [ErrorLabel.Babel]: new Set(), +} as const; + +const validFixtures = glob.sync(`${SRC_DIR}/**/fixtures/*/*.{ts,tsx}`); +const errorFixtures = glob.sync(`${SRC_DIR}/**/fixtures/_error_/*/*.{ts,tsx}`); + +const fixtures: readonly Fixture[] = [...validFixtures, ...errorFixtures].map( + absolute => { + const relativeToSrc = path.relative(SRC_DIR, absolute); + const { dir, ext } = path.parse(relativeToSrc); + const segments = dir.split(path.sep).filter(s => s !== 'fixtures'); + const name = segments.pop()!; + const snapshotPath = path.join(SRC_DIR, dir, 'snapshots'); + return { + absolute, + name, + ext, + isError: absolute.includes('/_error_/'), + isJSX: ext.endsWith('x'), + relative: path.relative(SRC_DIR, absolute), + segments, + snapshotPath, + snapshotFiles: { + success: { + tsestree: { + ast: path.join(snapshotPath, '1-TSESTree-AST.shot'), + tokens: path.join(snapshotPath, '2-TSESTree-Tokens.shot'), + }, + babel: { + ast: path.join(snapshotPath, '3-Babel-AST.shot'), + tokens: path.join(snapshotPath, '4-Babel-Tokens.shot'), + }, + alignment: { + ast: path.join(snapshotPath, '5-AST-Alignment-AST.shot'), + tokens: path.join(snapshotPath, '6-AST-Alignment-Tokens.shot'), + }, + }, + error: { + tsestree: path.join(snapshotPath, '1-TSESTree-Error.shot'), + babel: path.join(snapshotPath, '2-Babel-Error.shot'), + alignment: path.join(snapshotPath, '3-Alignment-Error.shot'), + }, + }, + }; + }, +); + +function isError(e: unknown): e is { code: unknown } { + return typeof e === 'object' && e != null && 'code' in e; +} + +function nestDescribe(fixture: Fixture, segments = fixture.segments): void { + if (segments.length > 0) { + describe(segments[0], () => { + nestDescribe(fixture, segments.slice(1)); + }); + } else { + const test = (): void => { + const contents = fs.readFileSync(fixture.absolute, 'utf8'); + + try { + makeDir.sync(fixture.snapshotPath); + } catch (e) { + if (isError(e) && e.code === 'EEXIST') { + // already exists - ignored + } else { + throw e; + } + } + + const tsestreeParsed = parseTSESTree(fixture, contents); + const babelParsed = parseBabel(fixture, contents); + const babelError = babelParsed.error !== 'NO ERROR'; + const tsestreeError = tsestreeParsed.error !== 'NO ERROR'; + let errorLabel: ErrorLabel; + if (!babelError && tsestreeError) { + errorLabel = ErrorLabel.TSESTree; + } else if (babelError && !tsestreeError) { + errorLabel = ErrorLabel.Babel; + } else if (babelError && tsestreeError) { + errorLabel = ErrorLabel.Both; + } else { + errorLabel = ErrorLabel.None; + } + if (fixture.isError) { + it('TSESTree - Error', () => { + expect(tsestreeParsed.error).toMatchSpecificSnapshot( + fixture.snapshotFiles.error.tsestree, + ); + }); + it('Babel - Error', () => { + expect(babelParsed.error).toMatchSpecificSnapshot( + fixture.snapshotFiles.error.babel, + ); + }); + it('Error Alignment', () => { + if ( + errorLabel === ErrorLabel.TSESTree || + errorLabel === ErrorLabel.Babel + ) { + fixturesWithErrorDifferences[errorLabel].add(fixture.relative); + } + expect(errorLabel).toMatchSpecificSnapshot( + fixture.snapshotFiles.error.alignment, + ); + }); + it('Should parse with errors', () => { + // if this fails and you WEREN'T expecting a parser error, then your fixture should not be in the `_error_` subfolder + // if this fails and you WERE expecting a parser error - then something is broken. + expect(errorLabel).not.toBe(ErrorLabel.None); + }); + } else { + it('TSESTree - AST', () => { + expect(tsestreeParsed.ast).toMatchSpecificSnapshot( + fixture.snapshotFiles.success.tsestree.ast, + ); + }); + it('TSESTree - Tokens', () => { + expect(tsestreeParsed.tokens).toMatchSpecificSnapshot( + fixture.snapshotFiles.success.tsestree.tokens, + ); + }); + + it('Babel - AST', () => { + expect(babelParsed.ast).toMatchSpecificSnapshot( + fixture.snapshotFiles.success.babel.ast, + ); + }); + it('Babel - Tokens', () => { + expect(babelParsed.tokens).toMatchSpecificSnapshot( + fixture.snapshotFiles.success.babel.tokens, + ); + }); + + it('AST Alignment - AST', () => { + const diffResult = snapshotDiff( + 'TSESTree', + tsestreeParsed.ast, + 'Babel', + babelParsed.ast, + ); + expect(diffResult).toMatchSpecificSnapshot( + fixture.snapshotFiles.success.alignment.ast, + ); + + if (diffHasChanges(diffResult)) { + fixturesWithASTDifferences.add(fixture.relative); + } + }); + it('AST Alignment - Token', () => { + const diffResult = snapshotDiff( + 'TSESTree', + tsestreeParsed.tokens, + 'Babel', + babelParsed.tokens, + ); + expect(diffResult).toMatchSpecificSnapshot( + fixture.snapshotFiles.success.alignment.tokens, + ); + + if (diffHasChanges(diffResult)) { + fixturesWithTokenDifferences.add(fixture.relative); + } + }); + + it('Should parse with no errors', () => { + // if this fails and you WERE expecting a parser error, then your fixture should be in the `_error_` subfolder + // if this fails and you WEREN'T expecting a parser error - then something is broken. + expect(errorLabel).toBe(ErrorLabel.None); + }); + } + }; + + if ([...fixture.segments, fixture.name].join(path.sep) === ONLY) { + // eslint-disable-next-line jest/no-focused-tests + describe.only(fixture.name, test); + } else { + describe(fixture.name, test); + } + } +} + +describe('AST Fixtures', () => { + fixtures.forEach(f => nestDescribe(f)); + + // once we've run all the tests, snapshot the list of fixtures that have differences for easy reference + it('List fixtures with AST differences', () => { + expect(fixturesWithASTDifferences).toMatchSpecificSnapshot( + path.resolve(__dirname, 'fixtures-with-differences-ast.shot'), + ); + }); + it('List fixtures with Token differences', () => { + expect(fixturesWithTokenDifferences).toMatchSpecificSnapshot( + path.resolve(__dirname, 'fixtures-with-differences-tokens.shot'), + ); + }); + it('List fixtures with Error differences', () => { + expect(fixturesWithErrorDifferences).toMatchSpecificSnapshot( + path.resolve(__dirname, 'fixtures-with-differences-errors.shot'), + ); + }); +}); diff --git a/packages/ast-spec/tests/util/parsers/babel.ts b/packages/ast-spec/tests/util/parsers/babel.ts new file mode 100644 index 00000000000..dbbfec34fd0 --- /dev/null +++ b/packages/ast-spec/tests/util/parsers/babel.ts @@ -0,0 +1,49 @@ +import { parse, ParserPlugin } from '@babel/eslint-parser'; +import { Fixture, ParserResponse } from './parser-types'; + +const PLUGINS: ParserPlugin[] = [ + // TODO - enable classFeatures instead of classProperties when we support it + // 'classFeatures', + 'classProperties', + 'decorators-legacy', + 'typescript', +]; + +export function parseBabel(fixture: Fixture, contents: string): ParserResponse { + const plugins = [...PLUGINS]; + if (fixture.isJSX) { + plugins.push('jsx'); + } + + let ast: unknown | 'ERROR' = 'ERROR'; + let tokens: unknown | 'ERROR' = 'ERROR'; + let error: unknown | 'NO ERROR' = 'NO ERROR'; + + try { + const result = parse(contents, { + allowImportExportEverywhere: true, + babelOptions: { + parserOpts: { + plugins, + }, + }, + ecmaFeatures: { + globalReturn: true, + }, + requireConfigFile: false, + sourceType: 'unambiguous', + }); + const { tokens: _, comments: __, ...program } = result; + + tokens = result.tokens; + ast = program; + } catch (e: unknown) { + error = e; + } + + return { + tokens, + ast, + error, + }; +} diff --git a/packages/ast-spec/tests/util/parsers/parser-types.ts b/packages/ast-spec/tests/util/parsers/parser-types.ts new file mode 100644 index 00000000000..6bc6fe71b3b --- /dev/null +++ b/packages/ast-spec/tests/util/parsers/parser-types.ts @@ -0,0 +1,33 @@ +interface SuccessSnapshotPaths { + readonly ast: string; + readonly tokens: string; +} + +export interface Fixture { + readonly absolute: string; + readonly name: string; + readonly ext: string; + readonly isError: boolean; + readonly isJSX: boolean; + readonly relative: string; + readonly segments: string[]; + readonly snapshotPath: string; + readonly snapshotFiles: { + readonly success: { + readonly tsestree: SuccessSnapshotPaths; + readonly babel: SuccessSnapshotPaths; + readonly alignment: SuccessSnapshotPaths; + }; + readonly error: { + readonly tsestree: string; + readonly babel: string; + readonly alignment: string; + }; + }; +} + +export interface ParserResponse { + readonly ast: unknown | 'ERROR'; + readonly tokens: unknown | 'ERROR'; + readonly error: unknown | 'NO ERROR'; +} diff --git a/packages/ast-spec/tests/util/parsers/typescript-estree.ts b/packages/ast-spec/tests/util/parsers/typescript-estree.ts new file mode 100644 index 00000000000..07a6fd64491 --- /dev/null +++ b/packages/ast-spec/tests/util/parsers/typescript-estree.ts @@ -0,0 +1,33 @@ +import { parse, TSESTree } from '../typescript-estree-import'; +import { Fixture, ParserResponse } from './parser-types'; + +export function parseTSESTree( + fixture: Fixture, + contents: string, +): ParserResponse { + let ast: TSESTree.Program | 'ERROR' = 'ERROR'; + let tokens: TSESTree.Token[] | 'ERROR' = 'ERROR'; + let error: unknown | 'NO ERROR' = 'NO ERROR'; + + try { + const result = parse(contents, { + comment: false, + jsx: fixture.ext.endsWith('x'), + loc: true, + range: true, + tokens: true, + }); + const { tokens: _, comments: __, ...program } = result; + + tokens = result.tokens; + ast = program; + } catch (e: unknown) { + error = e; + } + + return { + tokens, + ast, + error, + }; +} diff --git a/packages/ast-spec/tests/util/serializers/Node.ts b/packages/ast-spec/tests/util/serializers/Node.ts new file mode 100644 index 00000000000..a9e6b4ddf06 --- /dev/null +++ b/packages/ast-spec/tests/util/serializers/Node.ts @@ -0,0 +1,83 @@ +import type * as TSESTree from '../../../src'; +import { NewPlugin } from 'pretty-format'; +import { AST_NODE_TYPES } from '../../../src'; + +function sortKeys(node: TSESTree.Node): (keyof typeof node)[] { + const keySet = new Set(Object.keys(node)); + + // type place as first key + keySet.delete('type'); + // range and loc we place after all properties + keySet.delete('range'); + keySet.delete('loc'); + + // babel keys + keySet.delete('start'); + keySet.delete('end'); + if (node.type === AST_NODE_TYPES.Program) { + keySet.delete('interpreter'); + } + + return Array.from(keySet).sort((a, b) => + a.localeCompare(b), + ) as (keyof typeof node)[]; +} + +function stringifyLineAndColumn(loc: TSESTree.Position): string { + return `{ column: ${loc.column}, line: ${loc.line} }`; +} + +function isObject(val: unknown): val is Record { + return val != null && typeof val === 'object'; +} +function hasValidType(type: unknown): type is string { + return typeof type === 'string'; +} + +const serializer: NewPlugin = { + test(val: unknown) { + return isObject(val) && hasValidType(val.type); + }, + serialize(node: TSESTree.Node, config, indentation, depth, refs, printer) { + const keys = sortKeys(node); + const type = node.type; + const loc = node.loc; + const range = node.range; + + const outputLines = []; + const childIndentation = indentation + config.indent; + + const printValue = (value: unknown): string => + printer(value, config, childIndentation, depth, refs); + + outputLines.push(`${type} {`); + outputLines.push(`${childIndentation}type: ${printValue(type)},`); + + for (const key of keys) { + const value = node[key]; + if (value === undefined) { + continue; + } + + outputLines.push(`${childIndentation}${key}: ${printValue(value)},`); + } + + outputLines.push(''); + outputLines.push(`${childIndentation}range: [${range.join(', ')}],`); + outputLines.push( + `${childIndentation}loc: {`, + `${childIndentation}${config.indent}start: ${stringifyLineAndColumn( + loc.start, + )},`, + `${childIndentation}${config.indent}end: ${stringifyLineAndColumn( + loc.end, + )},`, + `${childIndentation}},`, + ); + outputLines.push(`${indentation}}`); + + return outputLines.join('\n'); + }, +}; + +export { serializer }; diff --git a/packages/ast-spec/tests/util/serializers/index.ts b/packages/ast-spec/tests/util/serializers/index.ts new file mode 100644 index 00000000000..c9c0e3c54be --- /dev/null +++ b/packages/ast-spec/tests/util/serializers/index.ts @@ -0,0 +1,6 @@ +import * as Node from './Node'; + +export const serializers = [ + // + Node.serializer, +] as const; diff --git a/packages/ast-spec/tests/util/serializers/string.ts b/packages/ast-spec/tests/util/serializers/string.ts new file mode 100644 index 00000000000..81750c26009 --- /dev/null +++ b/packages/ast-spec/tests/util/serializers/string.ts @@ -0,0 +1,38 @@ +import { NewPlugin } from 'pretty-format'; + +// custom string serializer so that we can use single-quoted strings instead of double quoted strings +// this plays nicer with the way that the snapshot diff result, which is a pure string +const serializer: NewPlugin = { + test(val: unknown) { + return typeof val === 'string'; + }, + serialize( + str: string, + // config, + // indentation, + // depth, + // refs, + // printer, + ) { + const characters: string[] = []; + + characters.push("'"); + for (const character of str) { + switch (character) { + case "'": + characters.push('\\'); + break; + + case '\\': + characters.push('\\'); + break; + } + characters.push(character); + } + characters.push("'"); + + return characters.join(''); + }, +}; + +export { serializer }; diff --git a/packages/ast-spec/tests/util/setupJest.ts b/packages/ast-spec/tests/util/setupJest.ts new file mode 100644 index 00000000000..6b9e99943bf --- /dev/null +++ b/packages/ast-spec/tests/util/setupJest.ts @@ -0,0 +1,8 @@ +import { addSerializer } from 'jest-specific-snapshot'; +import { serializers } from './serializers'; + +for (const serializer of serializers) { + // the jest types are wrong here + expect.addSnapshotSerializer(serializer); + addSerializer(serializer); +} diff --git a/packages/ast-spec/tests/util/snapshot-diff.ts b/packages/ast-spec/tests/util/snapshot-diff.ts new file mode 100644 index 00000000000..b78e8984537 --- /dev/null +++ b/packages/ast-spec/tests/util/snapshot-diff.ts @@ -0,0 +1,65 @@ +import { diff } from 'jest-diff'; +import { NO_DIFF_MESSAGE } from 'jest-diff/build/constants'; +import defaultPrinter from 'pretty-format'; +import * as NodeSerializer from './serializers/Node'; +import * as StringSerializer from './serializers/string'; + +function identity(value: T): T { + return value; +} + +function diffStrings( + valueA: unknown, + valueB: unknown, + valueAName: string, + valueBName: string, +): string | null { + return diff(valueA, valueB, { + expand: false, + // we want to show the entire file in the diff + // that way you don't have to try and figure out what lines map to which sections + contextLines: Number.MAX_SAFE_INTEGER, + aAnnotation: valueAName, + bAnnotation: valueBName, + aColor: identity, + bColor: identity, + changeColor: identity, + commonColor: identity, + patchColor: identity, + }); +} + +export function snapshotDiff( + valueAName: string, + valueA: unknown, + valueBName: string, + valueB: unknown, +): string { + const OPTIONS = { + plugins: [ + NodeSerializer.serializer, + // by default jest will quote the string with double quotes + // this means the diff string will have double quotes escaped and look ugly + // this is a single-quote string serializer which won't clash with the outer double quotes + // so we get a nicer looking diff because of it! + StringSerializer.serializer, + ], + }; + + const difference = diffStrings( + defaultPrinter(valueA, OPTIONS), + defaultPrinter(valueB, OPTIONS), + valueAName, + valueBName, + ); + + if (difference == null) { + throw new Error('Unexpected null when diffing snapshots.'); + } + + return 'Snapshot Diff:\n' + difference; +} + +export function diffHasChanges(diff: string): boolean { + return !diff.includes(NO_DIFF_MESSAGE); +} diff --git a/packages/ast-spec/tests/util/typescript-estree-import.ts b/packages/ast-spec/tests/util/typescript-estree-import.ts new file mode 100644 index 00000000000..a725ef2f5de --- /dev/null +++ b/packages/ast-spec/tests/util/typescript-estree-import.ts @@ -0,0 +1,17 @@ +/** + * Nx is picking up on the fact that we techically have a circular dependency between ast-spec + * and typescript-estree. + * + * This circular dependency only occurs in the tests/ for ast-spec and not in the main package source. + * + * We could therefore solve this by separating the ast-spec tests out into their own package, but the + * other option is to get Nx to turn a blind eye to the circular dependency by doing the following: + * + * - Removing @typescript-eslint/typescript-estree as an explicit devDependency in the package.json + * - Add an .nxignore file at the root of the monorepo which ignores this file (which we then in turn + * ensure is the only place we directly import from the @typescript-eslint/typescript-estree package). + */ + +// We need to ignore this lint error regarding it being missing from the package.json, see above. +// eslint-disable-next-line import/no-extraneous-dependencies +export { parse, TSESTree } from '@typescript-eslint/typescript-estree'; diff --git a/packages/ast-spec/tsconfig.build.json b/packages/ast-spec/tsconfig.build.json index 215a0282df2..89b0284199a 100644 --- a/packages/ast-spec/tsconfig.build.json +++ b/packages/ast-spec/tsconfig.build.json @@ -6,5 +6,6 @@ "rootDir": "./src", "resolveJsonModule": true }, - "include": ["src", "typings"] + "include": ["src", "typings"], + "exclude": ["**/fixtures/**"] } diff --git a/packages/ast-spec/tsconfig.json b/packages/ast-spec/tsconfig.json index 4b76ef4253b..fd3827cd5ba 100644 --- a/packages/ast-spec/tsconfig.json +++ b/packages/ast-spec/tsconfig.json @@ -4,5 +4,7 @@ "composite": false, "rootDir": "." }, - "include": ["src", "typings", "tests", "tools", "./rollup.config.ts"] + "include": ["src", "typings", "tests", "tools", "./rollup.config.ts"], + "exclude": ["**/fixtures/**"], + "references": [{ "path": "../typescript-estree/tsconfig.build.json" }] } diff --git a/packages/ast-spec/typings/babel-eslint-parser.d.ts b/packages/ast-spec/typings/babel-eslint-parser.d.ts new file mode 100644 index 00000000000..a18a6597a94 --- /dev/null +++ b/packages/ast-spec/typings/babel-eslint-parser.d.ts @@ -0,0 +1,24 @@ +declare module '@babel/eslint-parser' { + import type { TransformOptions } from '@babel/core'; + + export type { ParserPlugin } from '@babel/parser'; + + export interface Options { + readonly allowImportExportEverywhere?: boolean; + readonly babelOptions?: TransformOptions; + readonly ecmaFeatures?: { + readonly globalReturn?: boolean; + }; + readonly requireConfigFile?: boolean; + readonly sourceType?: string; + } + + export interface BabelAST { + readonly tokens: unknown; + readonly comments: unknown; + readonly [k: string]: unknown; + } + + export function parse(code: string, options: Options): BabelAST; + // export function parseForESLint(code: string, options: Options): unknown; +} diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index 5c165d5f659..cec9bc7e53e 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -32,6 +32,7 @@ "postbuild": "downlevel-dts dist _ts3.4/dist", "clean": "tsc -b tsconfig.build.json --clean", "postclean": "rimraf dist && rimraf _ts3.4 && rimraf coverage", + "clean-fixtures": "rimraf -g \"./src/**/fixtures/**/snapshots\"", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "generate:lib": "../../node_modules/.bin/ts-node --files --transpile-only tools/generate-lib.ts", "lint": "eslint . --ext .js,.ts --ignore-path='../../.eslintignore'", diff --git a/packages/scope-manager/tests/fixtures.test.ts b/packages/scope-manager/tests/fixtures.test.ts index b504710c4cf..f029367ba06 100644 --- a/packages/scope-manager/tests/fixtures.test.ts +++ b/packages/scope-manager/tests/fixtures.test.ts @@ -185,7 +185,7 @@ if (ONLY === '') { describe('ast snapshots should have an associated test', () => { for (const snap of snapshots) { it(snap.relative, () => { - fs.existsSync(snap.fixturePath); + expect(fs.existsSync(snap.fixturePath)).toBeTruthy(); }); } }); diff --git a/packages/types/tools/copy-ast-spec.ts b/packages/types/tools/copy-ast-spec.ts index 0288453a310..f1cb38be40d 100644 --- a/packages/types/tools/copy-ast-spec.ts +++ b/packages/types/tools/copy-ast-spec.ts @@ -1,18 +1,43 @@ -import chlidProcess from 'child_process'; +import childProcess from 'child_process'; import fs from 'fs'; import path from 'path'; import { promisify } from 'util'; const readFile = promisify(fs.readFile); const writeFile = promisify(fs.writeFile); -const execAsync = promisify(chlidProcess.exec); + +// the promisify util will eat the stderr logs +async function execAsync( + command: string, + args: ReadonlyArray, + options: childProcess.SpawnOptions, +): Promise { + return new Promise((resolve, reject) => { + const child = childProcess.spawn(command, args, { + ...options, + stdio: 'inherit', + }); + + child.on('error', e => reject(e)); + child.on('exit', () => resolve()); + child.on('close', () => resolve()); + + // (error, stdout, stderr) => { + // if (error) { + // console.error(stderr); + // reject(error); + // return; + // } + + // // console.log(stdout); + // resolve(); + // }, + }); +} const AST_SPEC_PATH = path.resolve(__dirname, '../../ast-spec'); const OUTPUT_PATH = path.join(path.resolve(__dirname, '../src/')); -// ensure the package is built -chlidProcess.execSync('yarn build', { cwd: AST_SPEC_PATH, stdio: 'inherit' }); - const HEADER = `\ /********************************************** * DO NOT MODIFY THIS FILE MANUALLY * @@ -43,12 +68,15 @@ async function copyFile( encoding: 'utf-8', }); - await execAsync(`yarn prettier --write ${outpath}`); + await execAsync('yarn', ['prettier', '--write', outpath], {}); console.log('Copied', fileName); } async function main(): Promise { + // ensure the package is built + await execAsync('yarn', ['build'], { cwd: AST_SPEC_PATH }); + await Promise.all([ copyFile('dist', 'ast-spec.ts', code => code.replace(/export declare enum/g, 'export enum'), diff --git a/packages/visitor-keys/tests/visitor-keys.test.ts b/packages/visitor-keys/tests/visitor-keys.test.ts index a6fe66bc540..ca727a5de33 100644 --- a/packages/visitor-keys/tests/visitor-keys.test.ts +++ b/packages/visitor-keys/tests/visitor-keys.test.ts @@ -20,6 +20,11 @@ const IGNORED_KEYS = new Set([ describe('Every visitor key should have an ast node type defined', () => { for (const key of keys) { if (IGNORED_KEYS.has(key)) { + if (types.has(key)) { + it(`${key} should not be ignored as it has an AST_NODE_TYPE defined`, () => { + expect(true).toBeFalsy(); + }); + } continue; } diff --git a/yarn.lock b/yarn.lock index 5486c7f7140..f402df780f0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,7 +2,7 @@ # yarn lockfile v1 -"@babel/code-frame@*", "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.14.5", "@babel/code-frame@^7.15.8": +"@babel/code-frame@*", "@babel/code-frame@^7.0.0", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.14.5": version "7.15.8" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.15.8.tgz#45990c47adadb00c03677baa89221f7cc23d2503" integrity sha512-2IAnmn8zbvC/jKYhq5Ki9I+DwjlrtMPUCH/CpHvqI4dNnlwHwsxoIhlc8WcYY5LSYknXQtAlFYuHfqAFCvQ4Wg== @@ -21,20 +21,20 @@ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.15.0.tgz#2dbaf8b85334796cafbb0f5793a90a2fc010b176" integrity sha512-0NqAC1IJE0S0+lL1SWFMxMkz1pKCNCjI4tr2Zx4LJSXxCLAdr6KyArnY+sno5m3yH9g737ygOyPABDsnXkpxiA== -"@babel/core@^7.1.0", "@babel/core@^7.7.2", "@babel/core@^7.7.5": - version "7.15.8" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.15.8.tgz#195b9f2bffe995d2c6c159e72fe525b4114e8c10" - integrity sha512-3UG9dsxvYBMYwRv+gS41WKHno4K60/9GPy1CJaH6xy3Elq8CTtvtjT5R5jmNhXfCYLX2mTw+7/aq5ak/gOE0og== - dependencies: - "@babel/code-frame" "^7.15.8" - "@babel/generator" "^7.15.8" - "@babel/helper-compilation-targets" "^7.15.4" - "@babel/helper-module-transforms" "^7.15.8" - "@babel/helpers" "^7.15.4" - "@babel/parser" "^7.15.8" - "@babel/template" "^7.15.4" - "@babel/traverse" "^7.15.4" - "@babel/types" "^7.15.6" +"@babel/core@*", "@babel/core@^7.1.0", "@babel/core@^7.7.2", "@babel/core@^7.7.5": + version "7.14.3" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.14.3.tgz#5395e30405f0776067fbd9cf0884f15bfb770a38" + integrity sha512-jB5AmTKOCSJIZ72sd78ECEhuPiDMKlQdDI/4QRI6lzYATx5SSogS1oQA2AoPecRCknm30gHi2l+QVvNUu3wZAg== + dependencies: + "@babel/code-frame" "^7.12.13" + "@babel/generator" "^7.14.3" + "@babel/helper-compilation-targets" "^7.13.16" + "@babel/helper-module-transforms" "^7.14.2" + "@babel/helpers" "^7.14.0" + "@babel/parser" "^7.14.3" + "@babel/template" "^7.12.13" + "@babel/traverse" "^7.14.2" + "@babel/types" "^7.14.2" convert-source-map "^1.7.0" debug "^4.1.0" gensync "^1.0.0-beta.2" @@ -42,7 +42,16 @@ semver "^6.3.0" source-map "^0.5.0" -"@babel/generator@^7.15.4", "@babel/generator@^7.15.8", "@babel/generator@^7.7.2": +"@babel/eslint-parser@*", "@babel/eslint-parser@^7.15.4": + version "7.15.4" + resolved "https://registry.yarnpkg.com/@babel/eslint-parser/-/eslint-parser-7.15.4.tgz#46385943726291fb3e8db99522c8099b15684387" + integrity sha512-hPMIAmGNbmQzXJIo2P43Zj9UhRmGev5f9nqdBFOWNGDGh6XKmjby79woBvg6y0Jur6yRfQBneDbUQ8ZVc1krFw== + dependencies: + eslint-scope "^5.1.1" + eslint-visitor-keys "^2.1.0" + semver "^6.3.0" + +"@babel/generator@^7.14.3", "@babel/generator@^7.15.4", "@babel/generator@^7.7.2": version "7.15.8" resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.15.8.tgz#fa56be6b596952ceb231048cf84ee499a19c0cd1" integrity sha512-ECmAKstXbp1cvpTTZciZCgfOt6iN64lR0d+euv3UZisU5awfRawOvg07Utn/qBGuH4bRIEZKrA/4LzZyXhZr8g== @@ -51,7 +60,7 @@ jsesc "^2.5.1" source-map "^0.5.0" -"@babel/helper-compilation-targets@^7.15.4": +"@babel/helper-compilation-targets@^7.13.16": version "7.15.4" resolved "https://registry.yarnpkg.com/@babel/helper-compilation-targets/-/helper-compilation-targets-7.15.4.tgz#cf6d94f30fbefc139123e27dd6b02f65aeedb7b9" integrity sha512-rMWPCirulnPSe4d+gwdWXLfAXTTBj8M3guAf5xFQJ0nvFY7tfNAFnWdqaHegHlgDZOCT4qvhF3BYlSJag8yhqQ== @@ -98,7 +107,7 @@ dependencies: "@babel/types" "^7.15.4" -"@babel/helper-module-transforms@^7.15.8": +"@babel/helper-module-transforms@^7.14.2": version "7.15.8" resolved "https://registry.yarnpkg.com/@babel/helper-module-transforms/-/helper-module-transforms-7.15.8.tgz#d8c0e75a87a52e374a8f25f855174786a09498b2" integrity sha512-DfAfA6PfpG8t4S6npwzLvTUpp0sS7JrcuaMiy1Y5645laRJIp/LiLGIBbQKaXSInK8tiGNI7FL7L8UvB8gdUZg== @@ -158,7 +167,7 @@ resolved "https://registry.yarnpkg.com/@babel/helper-validator-option/-/helper-validator-option-7.14.5.tgz#6e72a1fff18d5dfcb878e1e62f1a021c4b72d5a3" integrity sha512-OX8D5eeX4XwcroVW45NMvoYaIuFI+GQpA2a8Gi+X/U/cDUIRsV37qQfF905F0htTRCREQIB4KqPeaveRJUl3Ow== -"@babel/helpers@^7.15.4": +"@babel/helpers@^7.14.0": version "7.15.4" resolved "https://registry.yarnpkg.com/@babel/helpers/-/helpers-7.15.4.tgz#5f40f02050a3027121a3cf48d497c05c555eaf43" integrity sha512-V45u6dqEJ3w2rlryYYXf6i9rQ5YMNu4FLS6ngs8ikblhu2VdR1AqAd6aJjBzmf2Qzh6KOLqKHxEN9+TFbAkAVQ== @@ -176,7 +185,7 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@*", "@babel/parser@^7.1.0", "@babel/parser@^7.15.4", "@babel/parser@^7.15.7", "@babel/parser@^7.15.8", "@babel/parser@^7.7.2": +"@babel/parser@*", "@babel/parser@^7.1.0", "@babel/parser@^7.14.3", "@babel/parser@^7.15.4", "@babel/parser@^7.15.7", "@babel/parser@^7.7.2": version "7.15.8" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.15.8.tgz#7bacdcbe71bdc3ff936d510c15dcea7cf0b99016" integrity sha512-BRYa3wcQnjS/nqI8Ac94pYYpJfojHVvVXJ97+IDCImX4Jc8W8Xv1+47enbruk+q1etOpsQNwnfFcNGw+gtPGxA== @@ -279,7 +288,7 @@ dependencies: regenerator-runtime "^0.13.4" -"@babel/template@^7.15.4", "@babel/template@^7.3.3": +"@babel/template@^7.12.13", "@babel/template@^7.15.4", "@babel/template@^7.3.3": version "7.15.4" resolved "https://registry.yarnpkg.com/@babel/template/-/template-7.15.4.tgz#51898d35dcf3faa670c4ee6afcfd517ee139f194" integrity sha512-UgBAfEa1oGuYgDIPM2G+aHa4Nlo9Lh6mGD2bDBGMTbYnc38vulXPuC1MGjYILIEmlwl6Rd+BPR9ee3gm20CBtg== @@ -288,7 +297,7 @@ "@babel/parser" "^7.15.4" "@babel/types" "^7.15.4" -"@babel/traverse@^7.1.0", "@babel/traverse@^7.15.4", "@babel/traverse@^7.7.2": +"@babel/traverse@^7.1.0", "@babel/traverse@^7.14.2", "@babel/traverse@^7.15.4", "@babel/traverse@^7.7.2": version "7.15.4" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.15.4.tgz#ff8510367a144bfbff552d9e18e28f3e2889c22d" integrity sha512-W6lQD8l4rUbQR/vYgSuCAE75ADyyQvOpFVsvPPdkhf6lATXAsQIG9YdtOcu8BB1dZ0LKu+Zo3c1wEcbKeuhdlA== @@ -303,7 +312,7 @@ debug "^4.1.0" globals "^11.1.0" -"@babel/types@*", "@babel/types@^7.0.0", "@babel/types@^7.15.4", "@babel/types@^7.15.6", "@babel/types@^7.3.0", "@babel/types@^7.3.3": +"@babel/types@*", "@babel/types@^7.0.0", "@babel/types@^7.14.2", "@babel/types@^7.15.4", "@babel/types@^7.15.6", "@babel/types@^7.3.0", "@babel/types@^7.3.3": version "7.15.6" resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.15.6.tgz#99abdc48218b2881c058dd0a7ab05b99c9be758f" integrity sha512-BPU+7QhqNjmWyDO0/vitH/CuhpV8ZmK1wpKva8nuyNF5MJfuRNWMc+hc14+u9xT93kvykMdncrJT19h74uB1Ig== @@ -1029,7 +1038,7 @@ jest-haste-map "^27.3.1" jest-runtime "^27.3.1" -"@jest/transform@^27.2.2", "@jest/transform@^27.3.1": +"@jest/transform@^27.0.2", "@jest/transform@^27.2.2", "@jest/transform@^27.3.1": version "27.3.1" resolved "https://registry.yarnpkg.com/@jest/transform/-/transform-27.3.1.tgz#ff80eafbeabe811e9025e4b6f452126718455220" integrity sha512-3fSvQ02kuvjOI1C1ssqMVBKJpZf6nwoCiSu00zAKh5nrp3SptNtZy/8s5deayHnqxhjD9CWDJ+yqQwuQ0ZafXQ== @@ -1050,7 +1059,7 @@ source-map "^0.6.1" write-file-atomic "^3.0.0" -"@jest/types@^27.1.1", "@jest/types@^27.2.5": +"@jest/types@^27.0.2", "@jest/types@^27.1.1", "@jest/types@^27.2.5": version "27.2.5" resolved "https://registry.yarnpkg.com/@jest/types/-/types-27.2.5.tgz#420765c052605e75686982d24b061b4cbba22132" integrity sha512-nmuM4VuDtCZcY+eTpw+0nvstwReMsjPoj7ZR80/BbixulhLaiX+fbv8oeLW8WZlJMcsGQsTmMKT/iTZu1Uy/lQ== @@ -2137,10 +2146,10 @@ resolved "https://registry.yarnpkg.com/@types/babel__code-frame/-/babel__code-frame-7.0.3.tgz#eda94e1b7c9326700a4b69c485ebbc9498a0b63f" integrity sha512-2TN6oiwtNjOezilFVl77zwdNPwQWaDBBCCWWxyo1ctiO3vAtd7H/aB/CBJdw9+kqq3+latD0SXoedIuHySSZWw== -"@types/babel__core@^7.0.0", "@types/babel__core@^7.1.14": - version "7.1.16" - resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.16.tgz#bc12c74b7d65e82d29876b5d0baf5c625ac58702" - integrity sha512-EAEHtisTMM+KaKwfWdC3oyllIqswlznXCIVCt7/oRNrh+DhgT4UEBNC/jlADNjvw7UnfbcdkGQcPVZ1xYiLcrQ== +"@types/babel__core@*", "@types/babel__core@^7.0.0", "@types/babel__core@^7.1.14": + version "7.1.14" + resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.1.14.tgz#faaeefc4185ec71c389f4501ee5ec84b170cc402" + integrity sha512-zGZJzzBUVDo/eV6KgbE0f0ZI7dInEYvo12Rb70uNQDshC3SkRMb67ja0GgRHZgAX3Za6rhaWlvbDO8rrGyAb1g== dependencies: "@babel/parser" "^7.1.0" "@babel/types" "^7.0.0" @@ -3907,7 +3916,7 @@ didyoumean@^1.2.1: resolved "https://registry.yarnpkg.com/didyoumean/-/didyoumean-1.2.2.tgz#989346ffe9e839b4555ecf5666edea0d3e8ad037" integrity sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw== -diff-sequences@^27.0.6: +diff-sequences@^27.0.1, diff-sequences@^27.0.6: version "27.0.6" resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-27.0.6.tgz#3305cb2e55a033924054695cc66019fd7f8e5723" integrity sha512-ag6wfpBFyNXZ0p8pcuIDS//D8H062ZQJ3fzYxjpmeKjnz8W4pekL3AI8VohmyZmsWW2PWaHgjsmqR6L13101VQ== @@ -4229,7 +4238,7 @@ eslint-plugin-simple-import-sort@^7.0.0: resolved "https://registry.yarnpkg.com/eslint-plugin-simple-import-sort/-/eslint-plugin-simple-import-sort-7.0.0.tgz#a1dad262f46d2184a90095a60c66fef74727f0f8" integrity sha512-U3vEDB5zhYPNfxT5TYR7u01dboFZp+HNpnGhkDB2g/2E4wZ/g1Q9Ton8UwCLfRV9yAKyYqDh62oHOamvkFxsvw== -eslint-scope@^5.1.1: +eslint-scope@^5.1.0, eslint-scope@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c" integrity sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw== @@ -4264,7 +4273,7 @@ eslint-visitor-keys@^1.1.0, eslint-visitor-keys@^1.3.0: resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-1.3.0.tgz#30ebd1ef7c2fdff01c3a4f151044af25fab0523e" integrity sha512-6J72N8UNa462wa/KFODt/PJ3IU60SDpC3QXC1Hjc1BXXpfL2C9R5+AU7jhe0F6GREqVMh4Juu+NY7xn+6dipUQ== -eslint-visitor-keys@^2.0.0: +eslint-visitor-keys@^2.0.0, eslint-visitor-keys@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz#f65328259305927392c938ed44eb0a5c9b2bd303" integrity sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw== @@ -4474,7 +4483,7 @@ expand-tilde@^2.0.0, expand-tilde@^2.0.2: dependencies: homedir-polyfill "^1.0.1" -expect@^27.3.1: +expect@^27.0.2, expect@^27.3.1: version "27.3.1" resolved "https://registry.yarnpkg.com/expect/-/expect-27.3.1.tgz#d0f170b1f5c8a2009bab0beffd4bb94f043e38e7" integrity sha512-MrNXV2sL9iDRebWPGOGFdPQRl2eDQNu/uhxIMShjjx74T6kC6jFIkmQ6OqXDtevjGUkyB2IT56RzDBqXf/QPCg== @@ -6076,7 +6085,7 @@ jest-config@^27.3.1: micromatch "^4.0.4" pretty-format "^27.3.1" -jest-diff@^27.0.0, jest-diff@^27.3.1: +jest-diff@*, jest-diff@^27.0.0, jest-diff@^27.0.2, jest-diff@^27.3.1: version "27.3.1" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-27.3.1.tgz#d2775fea15411f5f5aeda2a5e02c2f36440f6d55" integrity sha512-PCeuAH4AWUo2O5+ksW4pL9v5xJAcIKPUPfIhZBcG1RKv/0+dvaWTQK1Nrau8d67dp65fOqbeMdoil+6PedyEPQ== @@ -6129,12 +6138,12 @@ jest-environment-node@^27.2.2, jest-environment-node@^27.3.1: jest-mock "^27.3.0" jest-util "^27.3.1" -jest-get-type@^27.0.6, jest-get-type@^27.3.1: +jest-get-type@^27.0.1, jest-get-type@^27.0.6, jest-get-type@^27.3.1: version "27.3.1" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-27.3.1.tgz#a8a2b0a12b50169773099eee60a0e6dd11423eff" integrity sha512-+Ilqi8hgHSAdhlQ3s12CAVNd8H96ZkQBfYoXmArzZnOfAtVAJEiPDBirjByEblvG/4LPJmkL+nBqPO3A1YJAEg== -jest-haste-map@^27.2.2, jest-haste-map@^27.3.1: +jest-haste-map@^27.0.2, jest-haste-map@^27.2.2, jest-haste-map@^27.3.1: version "27.3.1" resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-27.3.1.tgz#7656fbd64bf48bda904e759fc9d93e2c807353ee" integrity sha512-lYfNZIzwPccDJZIyk9Iz5iQMM/MH56NIIcGj7AFU1YyA4ewWFBl8z+YPJuSCRML/ee2cCt2y3W4K3VXPT6Nhzg== @@ -6186,7 +6195,7 @@ jest-leak-detector@^27.3.1: jest-get-type "^27.3.1" pretty-format "^27.3.1" -jest-matcher-utils@^27.3.1: +jest-matcher-utils@^27.0.2, jest-matcher-utils@^27.3.1: version "27.3.1" resolved "https://registry.yarnpkg.com/jest-matcher-utils/-/jest-matcher-utils-27.3.1.tgz#257ad61e54a6d4044e080d85dbdc4a08811e9c1c" integrity sha512-hX8N7zXS4k+8bC1Aj0OWpGb7D3gIXxYvPNK1inP5xvE4ztbz3rc4AkI6jGVaerepBnfWB17FL5lWFJT3s7qo8w== @@ -6196,7 +6205,7 @@ jest-matcher-utils@^27.3.1: jest-get-type "^27.3.1" pretty-format "^27.3.1" -jest-message-util@^27.3.1: +jest-message-util@^27.0.2, jest-message-util@^27.3.1: version "27.3.1" resolved "https://registry.yarnpkg.com/jest-message-util/-/jest-message-util-27.3.1.tgz#f7c25688ad3410ab10bcb862bcfe3152345c6436" integrity sha512-bh3JEmxsTZ/9rTm0jQrPElbY2+y48Rw2t47uMfByNyUVR+OfPh4anuyKsGqsNkXk/TI4JbLRZx+7p7Hdt6q1yg== @@ -6254,7 +6263,7 @@ jest-resolve@27.2.2: resolve "^1.20.0" slash "^3.0.0" -jest-resolve@^27.2.2, jest-resolve@^27.3.1: +jest-resolve@^27.0.2, jest-resolve@^27.2.2, jest-resolve@^27.3.1: version "27.3.1" resolved "https://registry.yarnpkg.com/jest-resolve/-/jest-resolve-27.3.1.tgz#0e5542172a1aa0270be6f66a65888647bdd74a3e" integrity sha512-Dfzt25CFSPo3Y3GCbxynRBZzxq9AdyNN+x/v2IqYx6KVT5Z6me2Z/PsSGFSv3cOSUZqJ9pHxilao/I/m9FouLw== @@ -6338,7 +6347,7 @@ jest-serializer@^27.0.6: "@types/node" "*" graceful-fs "^4.2.4" -jest-snapshot@^27.0.2, jest-snapshot@^27.3.1: +jest-snapshot@*, jest-snapshot@^27.0.2, jest-snapshot@^27.3.1: version "27.3.1" resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-27.3.1.tgz#1da5c0712a252d70917d46c037054f5918c49ee4" integrity sha512-APZyBvSgQgOT0XumwfFu7X3G5elj6TGhCBLbBdn3R1IzYustPGPE38F51dBWMQ8hRXa9je0vAdeVDtqHLvB6lg== @@ -6387,7 +6396,7 @@ jest-util@27.2.0: is-ci "^3.0.0" picomatch "^2.2.3" -jest-util@^27.0.0, jest-util@^27.2.0, jest-util@^27.3.1: +jest-util@^27.0.0, jest-util@^27.0.2, jest-util@^27.2.0, jest-util@^27.3.1: version "27.3.1" resolved "https://registry.yarnpkg.com/jest-util/-/jest-util-27.3.1.tgz#a58cdc7b6c8a560caac9ed6bdfc4e4ff23f80429" integrity sha512-8fg+ifEH3GDryLQf/eKZck1DEs2YuVPBCMOaHQxVVLmQwl/CDhWzrvChTX4efLZxGrw+AA0mSXv78cyytBt/uw== @@ -8109,7 +8118,7 @@ prettier@*, prettier@2.4.1: resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.4.1.tgz#671e11c89c14a4cfc876ce564106c4a6726c9f5c" integrity sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA== -pretty-format@*, pretty-format@^27.0.0, pretty-format@^27.2.2, pretty-format@^27.3.1: +pretty-format@*, pretty-format@^27.0.0, pretty-format@^27.0.2, pretty-format@^27.2.2, pretty-format@^27.3.1: version "27.3.1" resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-27.3.1.tgz#7e9486365ccdd4a502061fa761d3ab9ca1b78df5" integrity sha512-DR/c+pvFc52nLimLROYjnXPtolawm+uWDxr4FjuLDLUn+ktWnSN851KoHwHzzqq6rfCOjkzN8FLgDrSub6UDuA==