diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 116e43fdd53d..a3534dd85c31 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -96,6 +96,12 @@ jobs: # Website will be built by the Netlify GitHub App yarn build --exclude website + - 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: @@ -308,6 +314,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 website_tests: diff --git a/.prettierignore b/.prettierignore index 93e27c9f84d6..896d5c464a35 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 d61dbf50a74a..aee0ff73ab0d 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -242,5 +242,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 f0677068d037..c33f13702f89 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -27,10 +27,7 @@ { "icon": "jest_snapshot", "extensions": [ - ".ts.shot", - ".tsx.shot", - ".js.shot", - ".jsx.shot", + ".shot", ], "extends": "jest_snapshot" }, diff --git a/package.json b/package.json index d889f08dffa3..a57385f883d8 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,10 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, "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": "^16.0.1", "@commitlint/config-conventional": "^16.0.0", "@nrwl/cli": "13.8.5", @@ -63,6 +67,7 @@ "@nrwl/workspace": "13.8.5", "@swc/core": "^1.2.159", "@swc/jest": "^0.2.20", + "@types/babel__code-frame": "^7.0.3", "@types/debug": "^4.1.7", "@types/eslint-visitor-keys": "^1.0.0", "@types/glob": "^7.2.0", @@ -93,6 +98,8 @@ "glob": "^8.0.1", "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": "^4.0.0", "lint-staged": "^12.0.2", diff --git a/packages/ast-spec/jest.config.js b/packages/ast-spec/jest.config.js index 77fe4d022a95..ac3b63608b7a 100644 --- a/packages/ast-spec/jest.config.js +++ b/packages/ast-spec/jest.config.js @@ -5,4 +5,9 @@ module.exports = { ...require('../../jest.config.base.js'), testRegex: ['./tests/.+\\.test\\.ts$'], + collectCoverage: false, + 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 c07b779e4dc0..caacd9859ff8 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 b3ed1770b674..5c20542e4f92 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 000000000000..d9bb750ada25 --- /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 000000000000..d4b25d3584bf --- /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 000000000000..32918ff7c5f7 --- /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 000000000000..123225a18253 --- /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 000000000000..12cf01a79ca3 --- /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 000000000000..305258435809 --- /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 000000000000..e72c371e8425 --- /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 000000000000..b69460232224 --- /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 000000000000..140ca7e5d569 --- /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 000000000000..7b137a8c5dec --- /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 000000000000..e3a40451c7e4 --- /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 000000000000..098ed5e7a14f --- /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 000000000000..57d09b35b4cb --- /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 000000000000..bae3f5a82873 --- /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 000000000000..0cda23120060 --- /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 000000000000..d8e3d045b848 --- /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 000000000000..ac5930044d1e --- /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 000000000000..54a7219ce9a8 --- /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 000000000000..248c67fcb6ae --- /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 000000000000..a12e8045e83d --- /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 000000000000..d20ffd3e1308 --- /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 000000000000..4006c278dcb7 --- /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 000000000000..27ac3a41954c --- /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 000000000000..0fbe7f7fe385 --- /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 000000000000..9fbaa86d5a24 --- /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 000000000000..1bb1eef41abe --- /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 000000000000..259743a73f75 --- /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 000000000000..ab7726fcd526 --- /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 000000000000..f406c8123352 --- /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 000000000000..60af58e326d3 --- /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 000000000000..888d2f213d3f --- /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 000000000000..97881c1404c3 --- /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 000000000000..e57e9fa7313b --- /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 000000000000..3db0178e0a4f --- /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 000000000000..f0550dcabbe8 --- /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 000000000000..7354a4e9bfed --- /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 000000000000..f2e4581ba588 --- /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 000000000000..eb1816cba73b --- /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 000000000000..19b8f62ee26d --- /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 000000000000..915fd1d51f92 --- /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 000000000000..4e6a6de65314 --- /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 000000000000..9ead7d30ab75 --- /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 000000000000..98e26f81f22b --- /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 000000000000..b44e7f980bf9 --- /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 000000000000..7687be9ddb06 --- /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 000000000000..795e34e032cc --- /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 000000000000..bf9e1cf5e602 --- /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 000000000000..2e811c1316fb --- /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 000000000000..7bb36dc00673 --- /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 000000000000..dc5437192e6f --- /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 000000000000..578f3c6a8648 --- /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 000000000000..0a84daeb896c --- /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 000000000000..ec6443288fb5 --- /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 000000000000..432a1483eb47 --- /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 000000000000..5c213302190f --- /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 000000000000..5d0bc8ed7c76 --- /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 000000000000..da9fc3ba5ca5 --- /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 000000000000..3eb2b515a24e --- /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 000000000000..8f9634b6629e --- /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 000000000000..db93259e13a5 --- /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 000000000000..17f60ddc36a5 --- /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 000000000000..8c6277e35df2 --- /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 000000000000..1f5fd8cad4ef --- /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 000000000000..d8241f2f4d5a --- /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 000000000000..1a912d351164 --- /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 000000000000..337d09683e9e --- /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 000000000000..2f17f69fe6b8 --- /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 000000000000..7408520a611e --- /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 000000000000..ff9ee33e186d --- /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 000000000000..c0cae9a11154 --- /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 000000000000..6467e4a37f03 --- /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 000000000000..ffe359159d45 --- /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 000000000000..c5a75e6d5b1b --- /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 000000000000..ca4cb279c004 --- /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 000000000000..77b0476655c6 --- /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 000000000000..931998b9e187 --- /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 000000000000..2e21f7b78336 --- /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 000000000000..c5228690b09a --- /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 000000000000..160a01b3a57a --- /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 000000000000..de05a724a09f --- /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 000000000000..07fe25e0f650 --- /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 000000000000..b0aec089f615 --- /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 000000000000..0d56c0d096e8 --- /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 000000000000..9a3d334adee5 --- /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 000000000000..7fa282280172 --- /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 000000000000..f73a167dba3e --- /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 000000000000..7c5a5149bbed --- /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 000000000000..17ca652dc4a9 --- /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 000000000000..70cae74b3003 --- /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 000000000000..4e5329e739f9 --- /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 000000000000..9f84d173bfa3 --- /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 000000000000..0b476f5584ed --- /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 000000000000..7afa2b8839ba --- /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 000000000000..de9ab22cc6b9 --- /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 000000000000..89bca663a6db --- /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 000000000000..f3b75ecbb25a --- /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 000000000000..a99d685df3d6 --- /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 000000000000..8bab23b35992 --- /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 000000000000..5f6d97e5f2b1 --- /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 000000000000..04ccfb73d5bb --- /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 000000000000..3e05e98bfafd --- /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 000000000000..b5299226ad4c --- /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 000000000000..acdaf4c735f9 --- /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 000000000000..8bd09ace8dc6 --- /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 000000000000..c2ac962baac0 --- /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 000000000000..d78b6918cb1b --- /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 000000000000..bcf5b40695c1 --- /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 000000000000..a3d08a7b52a3 --- /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 000000000000..3a1a419a8312 --- /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 000000000000..35e627e28c5a --- /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 000000000000..a9b2c20c7fa1 --- /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 000000000000..e448d4b4299f --- /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 000000000000..e9c5efb68982 --- /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/assertion/fixture.ts b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/fixture.ts new file mode 100644 index 000000000000..32858cf72034 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/fixture.ts @@ -0,0 +1 @@ +export * from 'mod' assert { type: 'json' }; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..28172433eacf --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,70 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration assertion TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportAllDeclaration { + type: "ExportAllDeclaration", + assertions: Array [ + ImportAttribute { + type: "ImportAttribute", + key: Identifier { + type: "Identifier", + name: "type", + + range: [29, 33], + loc: { + start: { column: 29, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + value: Literal { + type: "Literal", + raw: "'json'", + value: "json", + + range: [35, 41], + loc: { + start: { column: 35, line: 1 }, + end: { column: 41, line: 1 }, + }, + }, + + range: [29, 41], + loc: { + start: { column: 29, line: 1 }, + end: { column: 41, line: 1 }, + }, + }, + ], + exported: null, + exportKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [14, 19], + loc: { + start: { column: 14, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [0, 44], + loc: { + start: { column: 0, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 45], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..c1e14a803e22 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration assertion 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: "'mod'", + + range: [14, 19], + loc: { + start: { column: 14, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "assert", + + range: [20, 26], + loc: { + start: { column: 20, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "type", + + range: [29, 33], + loc: { + start: { column: 29, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [33, 34], + loc: { + start: { column: 33, line: 1 }, + end: { column: 34, line: 1 }, + }, + }, + String { + type: "String", + value: "'json'", + + range: [35, 41], + loc: { + start: { column: 35, line: 1 }, + end: { column: 41, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [42, 43], + loc: { + start: { column: 42, line: 1 }, + end: { column: 43, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [43, 44], + loc: { + start: { column: 43, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..5a36d4040e4a --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/3-Babel-AST.shot @@ -0,0 +1,70 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration assertion Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportAllDeclaration { + type: "ExportAllDeclaration", + assertions: Array [ + ImportAttribute { + type: "ImportAttribute", + key: Identifier { + type: "Identifier", + name: "type", + + range: [29, 33], + loc: { + start: { column: 29, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + value: Literal { + type: "Literal", + raw: "'json'", + value: "json", + + range: [35, 41], + loc: { + start: { column: 35, line: 1 }, + end: { column: 41, line: 1 }, + }, + }, + + range: [29, 41], + loc: { + start: { column: 29, line: 1 }, + end: { column: 41, line: 1 }, + }, + }, + ], + exported: null, + exportKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [14, 19], + loc: { + start: { column: 14, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [0, 44], + loc: { + start: { column: 0, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 45], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..963999a2a4dc --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration assertion 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: "'mod'", + + range: [14, 19], + loc: { + start: { column: 14, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "assert", + + range: [20, 26], + loc: { + start: { column: 20, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "type", + + range: [29, 33], + loc: { + start: { column: 29, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [33, 34], + loc: { + start: { column: 33, line: 1 }, + end: { column: 34, line: 1 }, + }, + }, + String { + type: "String", + value: "'json'", + + range: [35, 41], + loc: { + start: { column: 35, line: 1 }, + end: { column: 41, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [42, 43], + loc: { + start: { column: 42, line: 1 }, + end: { column: 43, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [43, 44], + loc: { + start: { column: 43, line: 1 }, + end: { column: 44, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..077fe892d338 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration assertion AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..d5d091ffabd1 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/assertion/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration assertion AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; 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 000000000000..fca392829b84 --- /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 000000000000..0650677e2f6c --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,48 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration named TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportAllDeclaration { + type: "ExportAllDeclaration", + assertions: Array [], + 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 000000000000..7fc2d67babaf --- /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 000000000000..251754367731 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/named/snapshots/3-Babel-AST.shot @@ -0,0 +1,48 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration named Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportAllDeclaration { + type: "ExportAllDeclaration", + assertions: Array [], + 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 000000000000..66f249ee6ca3 --- /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 000000000000..8aabbae33575 --- /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 000000000000..5020f9f630ea --- /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 000000000000..86a4838f7b9b --- /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 000000000000..170461aa1dbe --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,39 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration unnamed TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportAllDeclaration { + type: "ExportAllDeclaration", + assertions: Array [], + 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 000000000000..29ffb6ae0fef --- /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 000000000000..67c28f6a2394 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/unnamed/snapshots/3-Babel-AST.shot @@ -0,0 +1,39 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration unnamed Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportAllDeclaration { + type: "ExportAllDeclaration", + assertions: Array [], + 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 000000000000..82327ff3352a --- /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 000000000000..351bb72f34fb --- /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 000000000000..e2a55391779c --- /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 000000000000..0386d9255b00 --- /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 000000000000..c289052b36c9 --- /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 000000000000..294c438cb03c --- /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: Unexpected reserved word 'enum'. (1:15)]`; 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 000000000000..32a1cb0d3000 --- /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 000000000000..dcefd115a281 --- /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 000000000000..d1633569950d --- /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 000000000000..a80c32336147 --- /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 000000000000..7ecaa9bcded4 --- /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 000000000000..81b83c5de986 --- /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 000000000000..bce2c7cd5eee --- /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 000000000000..6afc67d4a5b0 --- /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 000000000000..9f4c01a03373 --- /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 000000000000..4b535f12615c --- /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 000000000000..43ab9a3893ec --- /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 000000000000..318dee3aacf2 --- /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 000000000000..327cd763562b --- /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 000000000000..a6e68e983892 --- /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 000000000000..bc5b9ffa8c16 --- /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 000000000000..9773e0f17a93 --- /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 000000000000..1262745aeade --- /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 000000000000..74d6f62864bb --- /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 000000000000..6c6174587332 --- /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 000000000000..7ace75359644 --- /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 000000000000..ea9b101e1c22 --- /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 000000000000..e30c973e4c53 --- /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 000000000000..292689734d68 --- /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 000000000000..d379b69f6c45 --- /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 000000000000..b52b674b4d56 --- /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 000000000000..0472fbccb826 --- /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 000000000000..9b1f36f4e1e4 --- /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 000000000000..2d1ec238274a --- /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 000000000000..d4ccafd5b51a --- /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 000000000000..b49305998ffb --- /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 000000000000..85a0d39624f9 --- /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 000000000000..fc7a2baf0885 --- /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 000000000000..359c33602be1 --- /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 000000000000..c7f2151c9207 --- /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 000000000000..caaf4f896e88 --- /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 000000000000..166a1d77c3d6 --- /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 000000000000..4e62aa0dc6a7 --- /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 000000000000..25ab06d87ef7 --- /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 000000000000..4137a875c9fd --- /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 000000000000..4d3dd269c491 --- /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 000000000000..1328ba27a285 --- /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 000000000000..7804111002d7 --- /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 000000000000..f2ce271ea778 --- /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 000000000000..5703d446ea54 --- /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 000000000000..432ded443078 --- /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 000000000000..01f9049584e8 --- /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 000000000000..892ae8987da5 --- /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 000000000000..96e9c654eee5 --- /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 000000000000..386baca17315 --- /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 000000000000..59570dbd56d7 --- /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 000000000000..b3a2cd2b15ba --- /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 000000000000..98b11432232d --- /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 000000000000..44f7cd272d3d --- /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 000000000000..6e67c16fb8bd --- /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 000000000000..b5de7325dea2 --- /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 000000000000..7b56c8b8f391 --- /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 000000000000..11900ab6838c --- /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 000000000000..d52ccbb0406c --- /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 000000000000..be4bb919b887 --- /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 000000000000..e4567a57c93e --- /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 000000000000..1fc84e1257d5 --- /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 000000000000..fa730c9cc1d9 --- /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 000000000000..4c36019eea28 --- /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 000000000000..755e1480fde3 --- /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 000000000000..e528391c3b1c --- /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 000000000000..2619c1ffa782 --- /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 000000000000..9363ba0a28b3 --- /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 000000000000..778b30b15138 --- /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 000000000000..e0918e2af4ec --- /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 000000000000..aef22247d752 --- /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 000000000000..dae455b793b0 --- /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 000000000000..48eaeb62600c --- /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 000000000000..f4c959e63f26 --- /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 000000000000..209d1dbb63f2 --- /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 000000000000..7715558acb14 --- /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 000000000000..c0a93423d4de --- /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 492d0981b8ca..2cfe1cce5b33 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 000000000000..5faf31b8867a --- /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 000000000000..71841045f6c5 --- /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 000000000000..dabc7d927d5d --- /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 000000000000..efb973998424 --- /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 000000000000..c433d66cf649 --- /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 000000000000..4bb37139b1b5 --- /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 000000000000..b3ebe67f29a9 --- /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 000000000000..82e5ade47506 --- /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 000000000000..d9a2010f9256 --- /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 000000000000..9c89f7d7f370 --- /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 000000000000..70ef1140faae --- /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 000000000000..15aae2856e1b --- /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 000000000000..ec7e7945aaf4 --- /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 000000000000..bc1507d797f0 --- /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 000000000000..d3a01941b964 --- /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 000000000000..fd6445ddef39 --- /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 000000000000..bb46c3698b97 --- /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 000000000000..af9eba5ac2cc --- /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 000000000000..59d790cb18df --- /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 000000000000..dbe6913aab56 --- /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 000000000000..0d3d77ac4130 --- /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 000000000000..302c6c7c652d --- /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 000000000000..968987af2099 --- /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 000000000000..00f60c625f57 --- /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 000000000000..7eec000d816d --- /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 000000000000..7e7d8c008fc2 --- /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 000000000000..3ba27489473b --- /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 000000000000..f2d4bb40cc50 --- /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 000000000000..ed5896524bf1 --- /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 000000000000..9e96ac055223 --- /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 000000000000..cf5a26409d14 --- /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 000000000000..7d06f41fc053 --- /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 000000000000..060ae5187cf3 --- /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 000000000000..c5593e6762b6 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,61 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration aliased TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + assertions: Array [], + 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 }, + }, + }, + exportKind: "value", + 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 000000000000..24df13756b8d --- /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 000000000000..8978d2ea713e --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/3-Babel-AST.shot @@ -0,0 +1,61 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration aliased Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + assertions: Array [], + 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 }, + }, + }, + exportKind: "value", + 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 000000000000..bce9dd071b10 --- /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 000000000000..845f2cb5cfbc --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/aliased/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,66 @@ +// 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', + assertions: Array [], + 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 }, + }, + }, + exportKind: 'value', + 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 000000000000..ce523723d51e --- /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/assertion/fixture.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/assertion/fixture.ts new file mode 100644 index 000000000000..f139479dad01 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/assertion/fixture.ts @@ -0,0 +1 @@ +export { foo } from 'mod' assert { type: 'json' }; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..9136ca295cb1 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,102 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration assertion TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + assertions: Array [ + ImportAttribute { + type: "ImportAttribute", + key: Identifier { + type: "Identifier", + name: "type", + + range: [35, 39], + loc: { + start: { column: 35, line: 1 }, + end: { column: 39, line: 1 }, + }, + }, + value: Literal { + type: "Literal", + raw: "'json'", + value: "json", + + range: [41, 47], + loc: { + start: { column: 41, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + + range: [35, 47], + loc: { + start: { column: 35, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + ], + declaration: null, + exportKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [20, 25], + loc: { + start: { column: 20, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + specifiers: Array [ + ExportSpecifier { + type: "ExportSpecifier", + exported: Identifier { + type: "Identifier", + name: "foo", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + exportKind: "value", + local: Identifier { + type: "Identifier", + name: "foo", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], + + range: [0, 50], + loc: { + start: { column: 0, line: 1 }, + end: { column: 50, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 51], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/assertion/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/assertion/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..9a30eb2745ce --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/assertion/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,136 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration assertion 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: "foo", + + range: [9, 12], + loc: { + start: { column: 9, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [15, 19], + loc: { + start: { column: 15, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [20, 25], + loc: { + start: { column: 20, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "assert", + + range: [26, 32], + loc: { + start: { column: 26, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [33, 34], + loc: { + start: { column: 33, line: 1 }, + end: { column: 34, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "type", + + range: [35, 39], + loc: { + start: { column: 35, line: 1 }, + end: { column: 39, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [39, 40], + loc: { + start: { column: 39, line: 1 }, + end: { column: 40, line: 1 }, + }, + }, + String { + type: "String", + value: "'json'", + + range: [41, 47], + loc: { + start: { column: 41, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [48, 49], + loc: { + start: { column: 48, line: 1 }, + end: { column: 49, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [49, 50], + loc: { + start: { column: 49, line: 1 }, + end: { column: 50, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/assertion/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/assertion/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..b2ee980389e8 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/assertion/snapshots/3-Babel-AST.shot @@ -0,0 +1,102 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration assertion Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + assertions: Array [ + ImportAttribute { + type: "ImportAttribute", + key: Identifier { + type: "Identifier", + name: "type", + + range: [35, 39], + loc: { + start: { column: 35, line: 1 }, + end: { column: 39, line: 1 }, + }, + }, + value: Literal { + type: "Literal", + raw: "'json'", + value: "json", + + range: [41, 47], + loc: { + start: { column: 41, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + + range: [35, 47], + loc: { + start: { column: 35, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + ], + declaration: null, + exportKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [20, 25], + loc: { + start: { column: 20, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + specifiers: Array [ + ExportSpecifier { + type: "ExportSpecifier", + exported: Identifier { + type: "Identifier", + name: "foo", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + exportKind: "value", + local: Identifier { + type: "Identifier", + name: "foo", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], + + range: [0, 50], + loc: { + start: { column: 0, line: 1 }, + end: { column: 50, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 51], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/assertion/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/assertion/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..95aa314bf6b3 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/assertion/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,136 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration assertion 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: "foo", + + range: [9, 12], + loc: { + start: { column: 9, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [15, 19], + loc: { + start: { column: 15, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [20, 25], + loc: { + start: { column: 20, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "assert", + + range: [26, 32], + loc: { + start: { column: 26, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [33, 34], + loc: { + start: { column: 33, line: 1 }, + end: { column: 34, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "type", + + range: [35, 39], + loc: { + start: { column: 35, line: 1 }, + end: { column: 39, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [39, 40], + loc: { + start: { column: 39, line: 1 }, + end: { column: 40, line: 1 }, + }, + }, + String { + type: "String", + value: "'json'", + + range: [41, 47], + loc: { + start: { column: 41, line: 1 }, + end: { column: 47, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [48, 49], + loc: { + start: { column: 48, line: 1 }, + end: { column: 49, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [49, 50], + loc: { + start: { column: 49, line: 1 }, + end: { column: 50, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..258519a7adf2 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration assertion AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/assertion/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/assertion/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..dade8ee29e7f --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/assertion/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration assertion 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 000000000000..223d0a8b395b --- /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 000000000000..d33d4cd08d4d --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,59 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration class TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + assertions: Array [], + 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 000000000000..b9218046a087 --- /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 000000000000..b50c37aca337 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/class/snapshots/3-Babel-AST.shot @@ -0,0 +1,59 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration class Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + assertions: Array [], + 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 000000000000..cdfb7afcd34f --- /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 000000000000..cb90ab5e0fbc --- /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 000000000000..8f68d87f732a --- /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 000000000000..b1725174a5e8 --- /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 000000000000..e6cd6c4d7a38 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,71 @@ +// 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", + assertions: Array [], + 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 000000000000..13073c0479d3 --- /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 000000000000..59786b3f97ea --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/3-Babel-AST.shot @@ -0,0 +1,71 @@ +// 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", + assertions: Array [], + 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 000000000000..b5ea9d5fbf4b --- /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 000000000000..9aaae286a11a --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/declare-function/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,76 @@ +// 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', + assertions: Array [], + 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 000000000000..9b1647311bd1 --- /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 000000000000..3705c4fd946a --- /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 000000000000..70f1a5783f9c --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,49 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration enum TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + assertions: Array [], + 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 000000000000..5c6e73d4b258 --- /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 000000000000..cff1b64a3bcc --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/enum/snapshots/3-Babel-AST.shot @@ -0,0 +1,49 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration enum Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + assertions: Array [], + 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 000000000000..e7ad15b4a50c --- /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 000000000000..1a21129afb24 --- /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 000000000000..2d3cd94a36c5 --- /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 000000000000..f99d4277774f --- /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 000000000000..ad4118a633cc --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,62 @@ +// 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", + assertions: Array [], + declaration: FunctionDeclaration { + type: "FunctionDeclaration", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: Array [], + + range: [22, 24], + loc: { + start: { column: 22, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + 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 000000000000..c4c9340ff8c5 --- /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 000000000000..0a8a9e7e818c --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/function-declaration/snapshots/3-Babel-AST.shot @@ -0,0 +1,62 @@ +// 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", + assertions: Array [], + declaration: FunctionDeclaration { + type: "FunctionDeclaration", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: Array [], + + range: [22, 24], + loc: { + start: { column: 22, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + 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 000000000000..f60ad2056b01 --- /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 000000000000..fe318b3ed6ff --- /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 000000000000..502fe958a402 --- /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 000000000000..7e905f38bf5d --- /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 000000000000..3a91eb9c2525 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,61 @@ +// 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", + assertions: Array [], + 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 }, + }, + }, + exportKind: "value", + 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 000000000000..471a1862f6cf --- /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 000000000000..355669e5d302 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/3-Babel-AST.shot @@ -0,0 +1,61 @@ +// 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", + assertions: Array [], + 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 }, + }, + }, + exportKind: "value", + 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 000000000000..c01ed8b93a41 --- /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 000000000000..240f602618f3 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-braced/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,66 @@ +// 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', + assertions: Array [], + 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 }, + }, + }, + exportKind: 'value', + 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 000000000000..d3563662f8c1 --- /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 000000000000..606432a162aa --- /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 000000000000..4c2fa789c167 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,91 @@ +// 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", + assertions: Array [], + 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 }, + }, + }, + exportKind: "value", + 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 }, + }, + }, + exportKind: "value", + 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 000000000000..91bf0e7c2b99 --- /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 000000000000..d228386edb52 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/3-Babel-AST.shot @@ -0,0 +1,91 @@ +// 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", + assertions: Array [], + 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 }, + }, + }, + exportKind: "value", + 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 }, + }, + }, + exportKind: "value", + 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 000000000000..f29165c63d00 --- /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 000000000000..8d76dc7c5710 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/identifier-many/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,96 @@ +// 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', + assertions: Array [], + 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 }, + }, + }, + exportKind: 'value', + 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 }, + }, + }, + exportKind: 'value', + 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 000000000000..939b36fc37cd --- /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 000000000000..39df3b83f7e9 --- /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 000000000000..a301d0efca70 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,58 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration interface TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + assertions: Array [], + 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 000000000000..9a0b5ef7598a --- /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 000000000000..776ce5004ba2 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/3-Babel-AST.shot @@ -0,0 +1,58 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration interface Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + assertions: Array [], + 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 000000000000..c52d2829e2e4 --- /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 000000000000..02ddc518379b --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/interface/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,63 @@ +// 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', + assertions: Array [], + 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 000000000000..3bf1141ae946 --- /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 000000000000..851030bd0285 --- /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 000000000000..8bee64090fc2 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,58 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration namespace TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + assertions: Array [], + 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 000000000000..72df88433a45 --- /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 000000000000..494c5144247c --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/namespace/snapshots/3-Babel-AST.shot @@ -0,0 +1,58 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportNamedDeclaration namespace Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportNamedDeclaration { + type: "ExportNamedDeclaration", + assertions: Array [], + 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 000000000000..0a3d1ca1dee4 --- /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 000000000000..00a19c01c581 --- /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 000000000000..57daa643d18f --- /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 000000000000..f29cc6f5296e --- /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 000000000000..2a6f27ff6911 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,68 @@ +// 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", + assertions: Array [], + 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 000000000000..b7fb84a7c81e --- /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 000000000000..b4392aa8e9c9 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/3-Babel-AST.shot @@ -0,0 +1,68 @@ +// 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", + assertions: Array [], + 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 000000000000..597a4d5f2bdb --- /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 000000000000..db70418e9f1d --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/type-alias/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,73 @@ +// 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', + assertions: Array [], + 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 000000000000..6f04a9a69814 --- /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 000000000000..ad1d380d6cc4 --- /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 000000000000..64a85af7e541 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,71 @@ +// 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", + assertions: Array [], + 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 000000000000..73bd6c93bb9d --- /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 000000000000..8b842b6d5841 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/fixtures/variable-declaration/snapshots/3-Babel-AST.shot @@ -0,0 +1,71 @@ +// 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", + assertions: Array [], + 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 000000000000..1bfff47fa927 --- /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 000000000000..bb45021e9c4a --- /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 000000000000..de15dbc1cc63 --- /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 d2f4d75b3c2e..3e2989b74990 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts @@ -8,6 +8,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 000000000000..2a37d6b6582d --- /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 000000000000..59b5c479a758 --- /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 000000000000..6c8d721a41a5 --- /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 000000000000..e9685f2a425e --- /dev/null +++ b/packages/ast-spec/tests/fixtures.test.ts @@ -0,0 +1,281 @@ +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, + ParserResponse, + ParserResponseError, + ParserResponseSuccess, + ParserResponseType, +} 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 hasErrorCode(e: unknown): e is { code: unknown } { + return typeof e === 'object' && e != null && 'code' in e; +} + +function expectSuccessResponse( + thing: ParserResponse, +): asserts thing is ParserResponseSuccess { + expect(thing.type).toEqual(ParserResponseType.NoError); +} +function expectErrorResponse( + thing: ParserResponse, +): asserts thing is ParserResponseError { + expect(thing.type).toEqual(ParserResponseType.Error); +} + +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 (hasErrorCode(e) && e.code === 'EEXIST') { + // already exists - ignored + } else { + throw e; + } + } + + const tsestreeParsed = parseTSESTree(fixture, contents); + const babelParsed = parseBabel(fixture, contents); + const babelError = babelParsed.type === ParserResponseType.Error; + const tsestreeError = tsestreeParsed.type === ParserResponseType.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) { + if ( + errorLabel === ErrorLabel.TSESTree || + errorLabel === ErrorLabel.Babel + ) { + fixturesWithErrorDifferences[errorLabel].add(fixture.relative); + } + + 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', () => { + 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', () => { + expectSuccessResponse(tsestreeParsed); + expect(tsestreeParsed.ast).toMatchSpecificSnapshot( + fixture.snapshotFiles.success.tsestree.ast, + ); + }); + it('TSESTree - Tokens', () => { + expectSuccessResponse(tsestreeParsed); + expect(tsestreeParsed.tokens).toMatchSpecificSnapshot( + fixture.snapshotFiles.success.tsestree.tokens, + ); + }); + + it('Babel - AST', () => { + expectSuccessResponse(babelParsed); + expect(babelParsed.ast).toMatchSpecificSnapshot( + fixture.snapshotFiles.success.babel.ast, + ); + }); + it('Babel - Tokens', () => { + expectSuccessResponse(babelParsed); + expect(babelParsed.tokens).toMatchSpecificSnapshot( + fixture.snapshotFiles.success.babel.tokens, + ); + }); + + it('AST Alignment - AST', () => { + expectSuccessResponse(tsestreeParsed); + expectSuccessResponse(babelParsed); + 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', () => { + expectSuccessResponse(tsestreeParsed); + expectSuccessResponse(babelParsed); + 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', () => { + // log the error for debug purposes in case there wasn't supposed to be an error + switch (errorLabel) { + case ErrorLabel.None: + return; + + case ErrorLabel.Babel: + expectErrorResponse(babelParsed); + console.error('Babel:\n', babelParsed.error); + break; + + case ErrorLabel.TSESTree: + expectErrorResponse(tsestreeParsed); + console.error('TSESTree:\n', tsestreeParsed.error); + break; + + case ErrorLabel.Both: + expectErrorResponse(babelParsed); + expectErrorResponse(tsestreeParsed); + console.error('Babel:\n', babelParsed.error); + console.error('TSESTree:\n', tsestreeParsed.error); + break; + } + + // 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 000000000000..d5995880a802 --- /dev/null +++ b/packages/ast-spec/tests/util/parsers/babel.ts @@ -0,0 +1,47 @@ +import { parse, ParserPlugin } from '@babel/eslint-parser'; +import { ParserResponseType, Fixture, ParserResponse } from './parser-types'; + +const PLUGINS: ParserPlugin[] = [ + // TODO - enable classFeatures instead of classProperties when we support it + // 'classFeatures', + 'classProperties', + 'decorators-legacy', + 'importAssertions', + 'typescript', +]; + +export function parseBabel(fixture: Fixture, contents: string): ParserResponse { + const plugins = [...PLUGINS]; + if (fixture.isJSX) { + plugins.push('jsx'); + } + + try { + const result = parse(contents, { + allowImportExportEverywhere: true, + babelOptions: { + parserOpts: { + plugins, + }, + }, + ecmaFeatures: { + globalReturn: true, + }, + requireConfigFile: false, + sourceType: 'unambiguous', + }); + const { tokens: _, comments: __, ...program } = result; + + return { + type: ParserResponseType.NoError, + ast: program, + error: 'NO ERROR', + tokens: result.tokens, + }; + } catch (error: unknown) { + return { + type: ParserResponseType.Error, + 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 000000000000..1278d43a99ef --- /dev/null +++ b/packages/ast-spec/tests/util/parsers/parser-types.ts @@ -0,0 +1,45 @@ +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 enum ParserResponseType { + Error = 'Error', + NoError = 'NoError', +} + +export interface ParserResponseSuccess { + readonly type: ParserResponseType.NoError; + readonly ast: unknown; + // this exists for the error alignment test snapshots + readonly error: 'NO ERROR'; + readonly tokens: unknown; +} +export interface ParserResponseError { + readonly type: ParserResponseType.Error; + readonly error: unknown; +} +export type ParserResponse = ParserResponseSuccess | ParserResponseError; 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 000000000000..664b2caa8d33 --- /dev/null +++ b/packages/ast-spec/tests/util/parsers/typescript-estree.ts @@ -0,0 +1,45 @@ +/** + * Nx is picking up on the fact that we technically 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 removing + * @typescript-eslint/typescript-estree as an explicit devDependency in the package.json and just doing an import here. + * + * This should be the only place in the package that we import from typescript-estree. + */ + +// 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 +import { parse } from '@typescript-eslint/typescript-estree'; +import { ParserResponseType, Fixture, ParserResponse } from './parser-types'; + +export function parseTSESTree( + fixture: Fixture, + contents: string, +): ParserResponse { + try { + const result = parse(contents, { + comment: false, + jsx: fixture.ext.endsWith('x'), + loc: true, + range: true, + tokens: true, + }); + const { tokens: _, comments: __, ...program } = result; + + return { + type: ParserResponseType.NoError, + ast: program, + error: 'NO ERROR', + tokens: result.tokens, + }; + } catch (error: unknown) { + return { + type: ParserResponseType.Error, + 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 000000000000..a9e6b4ddf06c --- /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 000000000000..c9c0e3c54bef --- /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 000000000000..81750c260098 --- /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 000000000000..6b9e99943bf9 --- /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 000000000000..4bf6546eeecb --- /dev/null +++ b/packages/ast-spec/tests/util/snapshot-diff.ts @@ -0,0 +1,67 @@ +import { diff } from 'jest-diff'; +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; +} + +// https://github.com/facebook/jest/blob/a293b75310cfc209713df1d34d243eb258995316/packages/jest-diff/src/constants.ts#L8 +const NO_DIFF_MESSAGE = 'Compared values have no visual difference.'; + +export function diffHasChanges(diff: string): boolean { + return !diff.includes(NO_DIFF_MESSAGE); +} diff --git a/packages/ast-spec/tsconfig.build.json b/packages/ast-spec/tsconfig.build.json index 215a0282df2b..89b0284199a6 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 4b76ef4253b9..fd3827cd5bae 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 000000000000..4bcf8911caf3 --- /dev/null +++ b/packages/ast-spec/typings/babel-eslint-parser.d.ts @@ -0,0 +1,23 @@ +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; +} diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index d68aab94b24a..5a4f6423fda4 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -30,6 +30,7 @@ "scripts": { "build": "cd ../../ && nx build @typescript-eslint/scope-manager", "clean": "cd ../../ && nx clean @typescript-eslint/scope-manager", + "clean-fixtures": "cd ../../ && nx clean-fixtures @typescript-eslint/scope-manager", "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore", "generate:lib": "cd ../../ && nx generate-lib @typescript-eslint/scope-manager", "lint": "cd ../../ && nx lint @typescript-eslint/scope-manager", diff --git a/packages/scope-manager/project.json b/packages/scope-manager/project.json index 71a628c64aab..f60c2fd75a92 100644 --- a/packages/scope-manager/project.json +++ b/packages/scope-manager/project.json @@ -43,6 +43,16 @@ ] } }, + "clean-fixtures": { + "executor": "@nrwl/workspace:run-commands", + "options": { + "parallel": false, + "cwd": "packages/scope-manager", + "commands": [ + "rimraf -g \"./src/**/fixtures/**/snapshots\"" + ] + } + }, "lint": { "executor": "@nrwl/linter:eslint", "outputs": ["{options.outputFile}"], diff --git a/packages/scope-manager/tests/fixtures.test.ts b/packages/scope-manager/tests/fixtures.test.ts index b504710c4cfd..f029367ba06e 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 bd1a0b1120ca..8b7848d9a71e 100644 --- a/packages/types/tools/copy-ast-spec.ts +++ b/packages/types/tools/copy-ast-spec.ts @@ -1,11 +1,28 @@ -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()); + }); +} const AST_SPEC_PATH = path.resolve(__dirname, '../../ast-spec'); const OUTPUT_PATH = path.join(path.resolve(__dirname, '../src/generated')); @@ -43,12 +60,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 a6fe66bc5408..ca727a5de335 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 f4ac198c6852..c6e53fd2a06f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -137,7 +137,7 @@ dependencies: "@jridgewell/trace-mapping" "^0.3.0" -"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.16.0", "@babel/code-frame@^7.16.7", "@babel/code-frame@^7.8.3": +"@babel/code-frame@^7.0.0", "@babel/code-frame@^7.10.4", "@babel/code-frame@^7.12.13", "@babel/code-frame@^7.14.5", "@babel/code-frame@^7.16.0", "@babel/code-frame@^7.16.7", "@babel/code-frame@^7.8.3": version "7.16.7" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.16.7.tgz#44416b6bd7624b998f5b1af5d470856c40138789" integrity sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg== @@ -149,6 +149,27 @@ resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.17.7.tgz#078d8b833fbbcc95286613be8c716cef2b519fa2" integrity sha512-p8pdE6j0a29TNGebNm7NzYZWB3xVZJBZ7XGs42uAKzQo8VQ3F0By/cQCtUEABwIqw5zo6WA4NbmxsfzADzMKnQ== +"@babel/core@*", "@babel/core@^7.1.0", "@babel/core@^7.12.3", "@babel/core@^7.15.5", "@babel/core@^7.17.8", "@babel/core@^7.7.2", "@babel/core@^7.7.5", "@babel/core@^7.8.0": + version "7.17.8" + resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.17.8.tgz#3dac27c190ebc3a4381110d46c80e77efe172e1a" + integrity sha512-OdQDV/7cRBtJHLSOBqqbYNkOcydOgnX59TZx4puf41fzcVtN3e/4yqY8lMQsK+5X2lJtAdmA+6OHqsj1hBJ4IQ== + dependencies: + "@ampproject/remapping" "^2.1.0" + "@babel/code-frame" "^7.16.7" + "@babel/generator" "^7.17.7" + "@babel/helper-compilation-targets" "^7.17.7" + "@babel/helper-module-transforms" "^7.17.7" + "@babel/helpers" "^7.17.8" + "@babel/parser" "^7.17.8" + "@babel/template" "^7.16.7" + "@babel/traverse" "^7.17.3" + "@babel/types" "^7.17.0" + convert-source-map "^1.7.0" + debug "^4.1.0" + gensync "^1.0.0-beta.2" + json5 "^2.1.2" + semver "^6.3.0" + "@babel/core@7.12.9": version "7.12.9" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.12.9.tgz#fd450c4ec10cdbb980e2928b7aa7a28484593fc8" @@ -171,31 +192,19 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/core@^7.1.0", "@babel/core@^7.12.3", "@babel/core@^7.15.5", "@babel/core@^7.17.8", "@babel/core@^7.7.2", "@babel/core@^7.7.5", "@babel/core@^7.8.0": - version "7.17.8" - resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.17.8.tgz#3dac27c190ebc3a4381110d46c80e77efe172e1a" - integrity sha512-OdQDV/7cRBtJHLSOBqqbYNkOcydOgnX59TZx4puf41fzcVtN3e/4yqY8lMQsK+5X2lJtAdmA+6OHqsj1hBJ4IQ== +"@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: - "@ampproject/remapping" "^2.1.0" - "@babel/code-frame" "^7.16.7" - "@babel/generator" "^7.17.7" - "@babel/helper-compilation-targets" "^7.17.7" - "@babel/helper-module-transforms" "^7.17.7" - "@babel/helpers" "^7.17.8" - "@babel/parser" "^7.17.8" - "@babel/template" "^7.16.7" - "@babel/traverse" "^7.17.3" - "@babel/types" "^7.17.0" - convert-source-map "^1.7.0" - debug "^4.1.0" - gensync "^1.0.0-beta.2" - json5 "^2.1.2" + eslint-scope "^5.1.1" + eslint-visitor-keys "^2.1.0" semver "^6.3.0" -"@babel/generator@^7.12.5", "@babel/generator@^7.17.3", "@babel/generator@^7.17.7", "@babel/generator@^7.7.2": - version "7.17.7" - resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.17.7.tgz#8da2599beb4a86194a3b24df6c085931d9ee45ad" - integrity sha512-oLcVCTeIFadUoArDTwpluncplrYBmTCCZZgXCbgNGvOBBiSDDK3eWO4b/+eOTli5tKv1lg+a5/NAXg+nTcei1w== +"@babel/generator@^7.12.5", "@babel/generator@^7.17.7", "@babel/generator@^7.17.9", "@babel/generator@^7.7.2": + version "7.17.9" + resolved "https://registry.yarnpkg.com/@babel/generator/-/generator-7.17.9.tgz#f4af9fd38fa8de143c29fce3f71852406fc1e2fc" + integrity sha512-rAdDousTwxbIxbz5I7GEQ3lUip+xVCXooZNbsydCWs3xA7ZsYOv+CFRdzGxRX78BmQHu9B1Eso59AOZQOJDEdQ== dependencies: "@babel/types" "^7.17.0" jsesc "^2.5.1" @@ -275,21 +284,13 @@ dependencies: "@babel/types" "^7.16.7" -"@babel/helper-function-name@^7.16.7": - version "7.16.7" - resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.16.7.tgz#f1ec51551fb1c8956bc8dd95f38523b6cf375f8f" - integrity sha512-QfDfEnIUyyBSR3HtrtGECuZ6DAyCkYFp7GHl75vFtTnn6pjKeK0T1DB5lLkFvBea8MdaiUABx3osbgLyInoejA== +"@babel/helper-function-name@^7.16.7", "@babel/helper-function-name@^7.17.9": + version "7.17.9" + resolved "https://registry.yarnpkg.com/@babel/helper-function-name/-/helper-function-name-7.17.9.tgz#136fcd54bc1da82fcb47565cf16fd8e444b1ff12" + integrity sha512-7cRisGlVtiVqZ0MW0/yFB4atgpGLWEHUVYnb448hZK4x+vih0YO5UoS11XIYtZYqHd0dIPMdUSv8q5K4LdMnIg== dependencies: - "@babel/helper-get-function-arity" "^7.16.7" "@babel/template" "^7.16.7" - "@babel/types" "^7.16.7" - -"@babel/helper-get-function-arity@^7.16.7": - version "7.16.7" - resolved "https://registry.yarnpkg.com/@babel/helper-get-function-arity/-/helper-get-function-arity-7.16.7.tgz#ea08ac753117a669f1508ba06ebcc49156387419" - integrity sha512-flc+RLSOBXzNzVhcLu6ujeHUrD6tANAOU5ojrRx/as+tbzf8+stUCj7+IfRRoAbEZqj/ahXEMsjhOhgeZsrnTw== - dependencies: - "@babel/types" "^7.16.7" + "@babel/types" "^7.17.0" "@babel/helper-hoist-variables@^7.16.7": version "7.16.7" @@ -414,18 +415,18 @@ "@babel/types" "^7.17.0" "@babel/highlight@^7.16.7": - version "7.16.10" - resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.16.10.tgz#744f2eb81579d6eea753c227b0f570ad785aba88" - integrity sha512-5FnTQLSLswEj6IkgVw5KusNUUFY9ZGqe/TRFnP/BKYHYgfh7tc+C7mwiy95/yNP7Dh9x580Vv8r7u7ZfTBFxdw== + version "7.17.9" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.17.9.tgz#61b2ee7f32ea0454612def4fccdae0de232b73e3" + integrity sha512-J9PfEKCbFIv2X5bjTMiZu6Vf341N05QIY+d6FvVKynkG1S7G0j3I0QoRtWIrXhZ+/Nlb5Q0MzqL7TokEJ5BNHg== dependencies: "@babel/helper-validator-identifier" "^7.16.7" chalk "^2.0.0" js-tokens "^4.0.0" -"@babel/parser@^7.1.0", "@babel/parser@^7.12.7", "@babel/parser@^7.14.7", "@babel/parser@^7.16.7", "@babel/parser@^7.17.3", "@babel/parser@^7.17.8": - version "7.17.8" - resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.17.8.tgz#2817fb9d885dd8132ea0f8eb615a6388cca1c240" - integrity sha512-BoHhDJrJXqcg+ZL16Xv39H9n+AqJ4pcDrQBGZN+wHxIysrLZ3/ECwCBUch/1zUNhnsXULcONU3Ei5Hmkfk6kiQ== +"@babel/parser@*", "@babel/parser@^7.1.0", "@babel/parser@^7.12.7", "@babel/parser@^7.14.7", "@babel/parser@^7.15.7", "@babel/parser@^7.16.7", "@babel/parser@^7.17.8", "@babel/parser@^7.17.9": + version "7.17.9" + resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.17.9.tgz#9c94189a6062f0291418ca021077983058e171ef" + integrity sha512-vqUSBLP8dQHFPdPi9bc5GK9vRkYHJ49fsZdtoJ8EQ8ibpwk5rPKfvNIwChB0KVXcIjcepEBBd2VHC5r9Gy8ueg== "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression@^7.16.7": version "7.16.7" @@ -1161,17 +1162,17 @@ "@babel/types" "^7.16.7" "@babel/traverse@^7.12.9", "@babel/traverse@^7.13.0", "@babel/traverse@^7.16.7", "@babel/traverse@^7.16.8", "@babel/traverse@^7.17.3", "@babel/traverse@^7.7.2": - version "7.17.3" - resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.17.3.tgz#0ae0f15b27d9a92ba1f2263358ea7c4e7db47b57" - integrity sha512-5irClVky7TxRWIRtxlh2WPUUOLhcPN06AGgaQSB8AEwuyEBgJVuJ5imdHm5zxk8w0QS5T+tDfnDxAlhWjpb7cw== + version "7.17.9" + resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.17.9.tgz#1f9b207435d9ae4a8ed6998b2b82300d83c37a0d" + integrity sha512-PQO8sDIJ8SIwipTPiR71kJQCKQYB5NGImbOviK8K+kg5xkNSYXLBupuX9QhatFowrsvo9Hj8WgArg3W7ijNAQw== dependencies: "@babel/code-frame" "^7.16.7" - "@babel/generator" "^7.17.3" + "@babel/generator" "^7.17.9" "@babel/helper-environment-visitor" "^7.16.7" - "@babel/helper-function-name" "^7.16.7" + "@babel/helper-function-name" "^7.17.9" "@babel/helper-hoist-variables" "^7.16.7" "@babel/helper-split-export-declaration" "^7.16.7" - "@babel/parser" "^7.17.3" + "@babel/parser" "^7.17.9" "@babel/types" "^7.17.0" debug "^4.1.0" globals "^11.1.0" @@ -3727,10 +3728,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" @@ -7105,7 +7106,7 @@ eslint-utils@^3.0.0: dependencies: eslint-visitor-keys "^2.0.0" -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== @@ -9317,7 +9318,7 @@ jest-config@^27.5.1: slash "^3.0.0" strip-json-comments "^3.1.1" -jest-diff@^27.5.1: +jest-diff@*, jest-diff@^27.3.1, jest-diff@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-27.5.1.tgz#a07f5011ac9e6643cf8a95a462b7b1ecf6680def" integrity sha512-m0NvkX55LDt9T4mctTEgnZk3fmEg3NRYutvMPWM/0iPnkFj2wIeF45O1718cMSOFO1vINkqmxqD8vE37uTEbqw== @@ -9573,7 +9574,7 @@ jest-serializer@^27.5.1: "@types/node" "*" graceful-fs "^4.2.9" -jest-snapshot@^27.0.2, jest-snapshot@^27.5.1: +jest-snapshot@*, jest-snapshot@^27.0.2, jest-snapshot@^27.3.1, jest-snapshot@^27.5.1: version "27.5.1" resolved "https://registry.yarnpkg.com/jest-snapshot/-/jest-snapshot-27.5.1.tgz#b668d50d23d38054a51b42c4039cab59ae6eb6a1" integrity sha512-yYykXI5a0I31xX67mgeLw1DZ0bJB+gpq5IpSuCAoyDi0+BhgU/RIrL+RTzDmkNTchvDFWKP8lp+w/42Z3us5sA== @@ -11725,9 +11726,9 @@ pify@^5.0.0: integrity sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA== pirates@^4.0.4: - version "4.0.4" - resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.4.tgz#07df81e61028e402735cdd49db701e4885b4e6e6" - integrity sha512-ZIrVPH+A52Dw84R0L3/VS9Op04PuQ2SEoJL6bkshmiTic/HldyW9Tf7oH5mhJZBK7NmDx27vSMrYEXPXclpDKw== + version "4.0.5" + resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.5.tgz#feec352ea5c3268fb23a37c702ab1699f35a5f3b" + integrity sha512-8V9+HQPupnaXMA23c5hvl69zXvTwTzyAYasnkb0Tts4XvO4CliqONMOnvlq26rkhLC3nWDFBJf73LU1e1VZLaQ== pkg-dir@^4.1.0, pkg-dir@^4.2.0: version "4.2.0"