diff --git a/.github/actions/prepare-build/action.yml b/.github/actions/prepare-build/action.yml new file mode 100644 index 000000000000..a83f403c0ffc --- /dev/null +++ b/.github/actions/prepare-build/action.yml @@ -0,0 +1,22 @@ +name: "Prepare: Build" +description: "Prepares the repo for a job by running the build" +# inputs: - no inputs +# outputs: - no outputs + +runs: + using: "composite" + steps: + - uses: actions/cache@v3 + id: build-cache + with: + path: "**/dist/**" + key: ${{ runner.os }}-build-${{ github.ref }} + restore-keys: | + ${{ runner.os }}-build- + + # if the cache was hit - this will run in <1s + - name: Build + shell: bash + # Website will be built by the Netlify GitHub App + run: | + yarn build --exclude website diff --git a/.github/actions/prepare-install/action.yml b/.github/actions/prepare-install/action.yml new file mode 100644 index 000000000000..73fc2191a0dc --- /dev/null +++ b/.github/actions/prepare-install/action.yml @@ -0,0 +1,44 @@ +name: "Prepare: Checkout and Install" +description: "Prepares the repo for a job by checking out and installing dependencies" +inputs: + node-version: + description: "The node version to setup" + required: true + registry-url: + description: "Define registry-url" + required: false + +# outputs: - no outputs + +runs: + using: "composite" + steps: + - name: echo github.ref + shell: bash + run: echo ${{ github.ref }} + + - name: Use Node.js ${{ inputs.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ inputs.node-version }} + registry-url: ${{ inputs.registry-url }} + + - name: Get yarn cache directory path + shell: bash + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - uses: actions/cache@v3 + id: yarn-cache + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + # if the cache was hit - this will run in <1s + - name: Install dependencies + shell: bash + run: | + yarn --ignore-engines --frozen-lockfile --ignore-scripts + yarn check-clean-workspace-after-install diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 704793ed36f3..a2e01de99389 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,419 +9,189 @@ on: - '**' env: - PRIMARY_NODE_VERSION: 16 + PRIMARY_NODE_VERSION: 18 NX_BRANCH: ${{ github.event.number }} NX_RUN_GROUP: ${{ github.run_id }} - # Added the - at the end to function as a separator to improve readability in the PR comment from the Nx cloud app - NX_CLOUD_ENV_NAME: 'Node 12.x -' -jobs: - typecheck: - name: Typecheck - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: echo github.ref - run: echo ${{ github.ref }} - - - name: Use Node.js ${{ env.PRIMARY_NODE_VERSION }} - uses: actions/setup-node@v3 - with: - node-version: ${{ env.PRIMARY_NODE_VERSION }} - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- +defaults: + run: + shell: bash - - name: Install dependencies - run: | - yarn --ignore-engines --frozen-lockfile --ignore-scripts - yarn check-clean-workspace-after-install +# +# Workflow for how the CI spawns jobs: +# 1) Run the install and cache the install artefacts +# 2) Run the build and cache the output +# - In parallel we also any steps that don't need the build (like prettier) +# 3) Run the steps that depend on the build +# - - name: Build - run: | - # Website will be built by the Netlify GitHub App - yarn build --exclude website - - # Note that this command *also* type checks tests/tools, - # whereas the build only checks src files - - name: Typecheck all packages - run: yarn typecheck - - unit_test_on_primary_node_version: - name: Unit tests - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - name: echo github.ref - run: echo ${{ github.ref }} - - - name: Use Node.js ${{ env.PRIMARY_NODE_VERSION }} - uses: actions/setup-node@v3 - with: - node-version: ${{ env.PRIMARY_NODE_VERSION }} - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install dependencies - run: | - yarn --ignore-engines --frozen-lockfile --ignore-scripts - yarn check-clean-workspace-after-install - - - name: Build - run: | - # 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: - CI: true - - - name: Run unit tests for visitor-keys - run: npx nx test @typescript-eslint/visitor-keys - env: - CI: true - - - name: Run unit tests for scope-manager - run: npx nx test @typescript-eslint/scope-manager --code-coverage - env: - CI: true - - - name: Run unit tests for utils - run: npx nx test @typescript-eslint/utils - env: - CI: true - - - name: Run unit tests for type-utils - run: npx nx test @typescript-eslint/type-utils - env: - CI: true - - - name: Run unit tests for parser - run: npx nx test @typescript-eslint/parser - env: - CI: true - - - name: Run unit tests for eslint-plugin - run: npx nx test @typescript-eslint/eslint-plugin - env: - CI: true - - - name: Run unit tests for eslint-plugin-tslint - run: npx nx test @typescript-eslint/eslint-plugin-tslint - env: - CI: true - - - name: Run unit tests for eslint-plugin-internal - run: npx nx test @typescript-eslint/eslint-plugin-internal - env: - CI: true - - - name: Publish code coverage report - uses: codecov/codecov-action@v3 - with: - token: ${{ secrets.CODECOV_TOKEN }} - files: packages/**/coverage/lcov.info - flags: unittest - name: codecov - - spellcheck: - name: Spellcheck +jobs: + install: + name: Checkout and Install runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ env.PRIMARY_NODE_VERSION }} - uses: actions/setup-node@v3 + - name: Checkout + uses: actions/checkout@v3 + - name: Install + uses: ./.github/actions/prepare-install with: node-version: ${{ env.PRIMARY_NODE_VERSION }} - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install dependencies - run: | - yarn --ignore-engines --frozen-lockfile --ignore-scripts - yarn check-clean-workspace-after-install - - - name: Check spelling - run: yarn check-spelling - - check_format: - name: Check Format + build: + name: Build All Packages + needs: [install] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ env.PRIMARY_NODE_VERSION }} - uses: actions/setup-node@v3 + - name: Checkout + uses: actions/checkout@v3 + - name: Install + uses: ./.github/actions/prepare-install with: node-version: ${{ env.PRIMARY_NODE_VERSION }} + - name: Build + uses: ./.github/actions/prepare-build - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install dependencies - run: | - yarn --ignore-engines --frozen-lockfile --ignore-scripts - yarn check-clean-workspace-after-install - - - name: Lint markdown - run: yarn lint-markdown - - markdownlint: - name: Markdownlint + lint_without_build: + name: Lint + needs: [install] runs-on: ubuntu-latest + strategy: + matrix: + lint-task: [ + "check-spelling", + "check-format", + "lint-markdown", + ] steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ env.PRIMARY_NODE_VERSION }} - uses: actions/setup-node@v3 + - name: Checkout + uses: actions/checkout@v3 + - name: Install + uses: ./.github/actions/prepare-install with: node-version: ${{ env.PRIMARY_NODE_VERSION }} - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install dependencies - run: | - yarn --ignore-engines --frozen-lockfile --ignore-scripts - yarn check-clean-workspace-after-install + - name: Run Check + run: yarn ${{ matrix.lint-task }} - - name: Check code formatting - run: yarn check-format - - eslint: - name: ESLint + lint_with_build: + name: Lint + # because we lint with our own tooling, we need to build + needs: [build] runs-on: ubuntu-latest + strategy: + matrix: + lint-task: [ + "lint", + "typecheck", + ] steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ env.PRIMARY_NODE_VERSION }} - uses: actions/setup-node@v3 + - name: Checkout + uses: actions/checkout@v3 + - name: Install + uses: ./.github/actions/prepare-install with: node-version: ${{ env.PRIMARY_NODE_VERSION }} - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install dependencies - run: | - yarn --ignore-engines --frozen-lockfile --ignore-scripts - yarn check-clean-workspace-after-install - - name: Build - run: | - # Website will be built by the Netlify GitHub App - yarn build --exclude website + uses: ./.github/actions/prepare-build - - name: Lint code - run: yarn lint + - name: Run Check + run: yarn ${{ matrix.lint-task }} integration_tests: name: Run integration tests on primary Node.js version + needs: [build] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ env.PRIMARY_NODE_VERSION }} - uses: actions/setup-node@v3 + - name: Checkout + uses: actions/checkout@v3 + - name: Install + uses: ./.github/actions/prepare-install with: node-version: ${{ env.PRIMARY_NODE_VERSION }} - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install dependencies - run: | - yarn --ignore-engines --frozen-lockfile --ignore-scripts - yarn check-clean-workspace-after-install - - name: Build - run: | - # Website will be built by the Netlify GitHub App - yarn build --exclude website + uses: ./.github/actions/prepare-build - name: Run integrations tests run: yarn test-integration env: CI: true - unit_tests_on_other_node_versions: - name: Run unit tests on other Node.js versions + unit_tests: + name: Run Unit Tests + needs: [build] runs-on: ubuntu-latest strategy: matrix: - node-version: [12.x, 14.x, 16.x] + # just run on the oldest and latest supported versions and assume the intermediate versions are good + node-version: [12, 18] + package: [ + "ast-spec", + "eslint-plugin", + "eslint-plugin-internal", + "eslint-plugin-tslint", + "parser", + "scope-manager", + "type-utils", + "typescript-estree", + "utils", + "visitor-keys", + ] env: # Added the - at the end to function as a separator to improve readability in the PR comment from the Nx cloud app NX_CLOUD_ENV_NAME: 'Node ${{ matrix.node-version }} -' + COLLECT_COVERAGE: false steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + - name: Checkout + uses: actions/checkout@v3 with: - node-version: ${{ matrix.node-version }} - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + fetch-depth: 2 + - name: Install + uses: ./.github/actions/prepare-install with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install dependencies - run: | - yarn --ignore-engines --frozen-lockfile --ignore-scripts - yarn check-clean-workspace-after-install - + node-version: ${{ env.PRIMARY_NODE_VERSION }} - name: Build - run: | - # Website will be built by the Netlify GitHub App - yarn build --exclude website - - - name: Run unit tests for typescript-estree - run: npx nx test @typescript-eslint/typescript-estree - env: - CI: true - - - name: Run unit tests for visitor-keys - run: npx nx test @typescript-eslint/visitor-keys - env: - CI: true - - - name: Run unit tests for scope-manager - run: npx nx test @typescript-eslint/scope-manager - env: - CI: true - - - name: Run unit tests for utils - run: npx nx test @typescript-eslint/utils - env: - CI: true - - - name: Run unit tests for type-utils - run: npx nx test @typescript-eslint/type-utils - env: - CI: true - - - name: Run unit tests for parser - run: npx nx test @typescript-eslint/parser - env: - CI: true - - - name: Run unit tests for eslint-plugin - run: npx nx test @typescript-eslint/eslint-plugin + uses: ./.github/actions/prepare-build + + # collect coverage on the primary node version + # we don't collect coverage on other node versions so they run faster + # note that we don't do this as a single `run` with a flag because some + # packages don't collect coverage on purpose, so forcing `--coverage=true` + # would override the config + - name: Run unit tests with coverage for ${{ matrix.package }} + if: env.PRIMARY_NODE_VERSION == matrix.node-version + run: npx nx test @typescript-eslint/${{ matrix.package }} env: CI: true - - - name: Run unit tests for eslint-plugin-tslint - run: npx nx test @typescript-eslint/eslint-plugin-tslint + - name: Run unit tests for ${{ matrix.package }} + if: env.PRIMARY_NODE_VERSION != matrix.node-version + run: npx nx test @typescript-eslint/${{ matrix.package }} --coverage=false 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 + - name: Store coverage for uploading + if: env.PRIMARY_NODE_VERSION == matrix.node-version + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.package }}-coverage + path: packages/${{ matrix.package }}/coverage/lcov.info + # Sadly 1 day is the minimum + retention-days: 1 website_tests: name: Website tests + needs: [build] runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - name: Checkout + uses: actions/checkout@v3 with: fetch-depth: 2 - - - name: echo github.ref - run: echo ${{ github.ref }} - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) + - name: Install + uses: ./.github/actions/prepare-install with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install dependencies - run: yarn --ignore-engines --frozen-lockfile + node-version: ${{ env.PRIMARY_NODE_VERSION }} + - name: Build + uses: ./.github/actions/prepare-build - name: Cypress run uses: cypress-io/github-action@v2 @@ -430,62 +200,59 @@ jobs: start: yarn start - uses: actions/upload-artifact@v3 - if: always() with: name: screenshots path: | packages/website/cypress/screenshots/ packages/website/cypress/videos/ + upload_coverage: + name: Upload Codecov Coverage + needs: [unit_tests] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Download coverage reports + uses: actions/download-artifact@v3 + with: + path: coverage + + - name: Publish code coverage report + uses: codecov/codecov-action@v3 + with: + token: ${{ secrets.CODECOV_TOKEN }} + files: coverage/**/lcov.info + flags: unittest + name: codecov + publish_canary_version: name: Publish the latest code as a canary version runs-on: ubuntu-latest needs: [ - typecheck, - unit_test_on_primary_node_version, - unit_tests_on_other_node_versions, - spellcheck, - check_format, - markdownlint, - eslint, integration_tests, + lint_with_build, + lint_without_build, + unit_tests, ] if: github.repository == 'typescript-eslint/typescript-eslint' && github.ref == 'refs/heads/main' steps: - - uses: actions/checkout@v3 - # Fetch all history for all tags and branches in this job because lerna needs it - - run: | - git fetch --prune --unshallow - - - name: Use Node.js ${{ env.PRIMARY_NODE_VERSION }} - uses: actions/setup-node@v3 + - name: Checkout + uses: actions/checkout@v3 + - name: Install + uses: ./.github/actions/prepare-install with: node-version: ${{ env.PRIMARY_NODE_VERSION }} - registry-url: https://registry.npmjs.org/ - - - name: Get yarn cache directory path - id: yarn-cache-dir-path - run: echo "::set-output name=dir::$(yarn cache dir)" - - - uses: actions/cache@v3 - id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`) - with: - path: ${{ steps.yarn-cache-dir-path.outputs.dir }} - key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install dependencies - run: | - yarn --ignore-engines --frozen-lockfile --ignore-scripts - yarn check-clean-workspace-after-install - + registry-url: "https://registry.npmjs.org" - name: Build - run: | - # Website will be built by the Netlify GitHub App - yarn build --exclude website + uses: ./.github/actions/prepare-build + + # Fetch all history for all tags and branches in this job because lerna needs it + - run: | + git fetch --prune --unshallow - name: Publish all packages to npm run: npx lerna publish --loglevel=verbose --canary --exact --force-publish --yes diff --git a/.github/workflows/lock.yml b/.github/workflows/lock.yml index e088e1d85ad0..84152062b220 100644 --- a/.github/workflows/lock.yml +++ b/.github/workflows/lock.yml @@ -11,9 +11,9 @@ jobs: - uses: dessant/lock-threads@v3 with: github-token: ${{ github.token }} - issue-lock-inactive-days: "30" + issue-inactive-days: "30" issue-lock-reason: "resolved" - issue-lock-comment: "" - pr-lock-inactive-days: "30" + issue-comment: "" + pr-inactive-days: "30" pr-lock-reason: "resolved" - pr-lock-comment: "" + pr-comment: "" diff --git a/CHANGELOG.md b/CHANGELOG.md index 390589e4a2a5..6552077df3d7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,27 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) + + +### Bug Fixes + +* **ast-spec:** add `SpreadElement` to `ArrayExpression.elements` ([#5025](https://github.com/typescript-eslint/typescript-eslint/issues/5025)) ([9f3121b](https://github.com/typescript-eslint/typescript-eslint/commit/9f3121b228b9c066bff7a6011aecf269ac55f17c)) +* **eslint-plugin:** [member-delimiter-style] autofixer result is not as expected when comments after the delimiter with option `delimiter: 'none'` ([#5029](https://github.com/typescript-eslint/typescript-eslint/issues/5029)) ([ed7b5f6](https://github.com/typescript-eslint/typescript-eslint/commit/ed7b5f61d93799fec3e38a87935ab9caa3abe279)) +* **eslint-plugin:** [member-delimiter-style] autofixer result is not as expected with option `delimiter: 'none'` ([#5023](https://github.com/typescript-eslint/typescript-eslint/issues/5023)) ([9e97a11](https://github.com/typescript-eslint/typescript-eslint/commit/9e97a11ecd80be5c63c980bfe8d8e57400221cec)) +* **eslint-plugin:** [prefer-readonly] correct issue with anonymus functions ([#4974](https://github.com/typescript-eslint/typescript-eslint/issues/4974)) ([952e2f0](https://github.com/typescript-eslint/typescript-eslint/commit/952e2f068862dde089ec03d3eb5452d1ee3e9271)), closes [#2590](https://github.com/typescript-eslint/typescript-eslint/issues/2590) + + +### Features + +* [4.7] support instantiation expressions ([#4938](https://github.com/typescript-eslint/typescript-eslint/issues/4938)) ([79fbc77](https://github.com/typescript-eslint/typescript-eslint/commit/79fbc7743ae5dce3190f8168776e0204755390ad)) +* [4.7] support optional variance annotation ([#4831](https://github.com/typescript-eslint/typescript-eslint/issues/4831)) ([7e7b24c](https://github.com/typescript-eslint/typescript-eslint/commit/7e7b24c196e6d968e48f97f46feae5e7027e22d2)) +* **typescript-estree:** `extends` constraints for `infer` ([#4830](https://github.com/typescript-eslint/typescript-eslint/issues/4830)) ([8cbbcc3](https://github.com/typescript-eslint/typescript-eslint/commit/8cbbcc3d317779e0dcba15d3835137f38383de34)) + + + + + # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) diff --git a/jest.config.base.js b/jest.config.base.js index 4470c1be07b9..b94573bf7196 100644 --- a/jest.config.base.js +++ b/jest.config.base.js @@ -3,17 +3,34 @@ // @ts-check /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { - collectCoverage: false, + collectCoverage: true, collectCoverageFrom: ['src/**/*.{js,jsx,ts,tsx}'], - coverageReporters: ['text-summary', 'lcov'], - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], + coverageReporters: ['lcov'], + moduleFileExtensions: [ + 'ts', + 'tsx', + 'mts', + 'mtsx', + 'js', + 'jsx', + 'mjs', + 'mjsx', + 'json', + 'node', + ], resolver: '/../../tests/jest-resolver.js', + testRegex: ['./tests/.+\\.test\\.ts$', './tests/.+\\.spec\\.ts$'], transform: { '^.+\\.(t|j)sx?$': [ '@swc/jest', { jsc: { target: 'es2019', + transform: { + react: { + runtime: 'automatic', + }, + }, }, }, ], diff --git a/jest.preset.js b/jest.preset.js deleted file mode 100644 index 3d08453c18d0..000000000000 --- a/jest.preset.js +++ /dev/null @@ -1,15 +0,0 @@ -// @ts-check - -/* eslint-disable import/no-extraneous-dependencies */ -/* eslint-disable @typescript-eslint/no-unsafe-assignment */ - -'use strict'; - -/** @type {import('@nrwl/jest/preset/jest-preset')} */ -const nxPreset = require('@nrwl/jest/preset'); - -const { transform: _ignoredTsJestTransform, ...configToUse } = nxPreset; - -module.exports = { - ...configToUse, -}; diff --git a/lerna.json b/lerna.json index 92f35158ff3e..3ebfe1032e95 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "5.25.0", + "version": "5.26.0", "npmClient": "yarn", "useWorkspaces": true, "stream": true diff --git a/packages/ast-spec/CHANGELOG.md b/packages/ast-spec/CHANGELOG.md index 56b71dfd61bd..7b5375ac92c8 100644 --- a/packages/ast-spec/CHANGELOG.md +++ b/packages/ast-spec/CHANGELOG.md @@ -3,6 +3,23 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) + + +### Bug Fixes + +* **ast-spec:** add `SpreadElement` to `ArrayExpression.elements` ([#5025](https://github.com/typescript-eslint/typescript-eslint/issues/5025)) ([9f3121b](https://github.com/typescript-eslint/typescript-eslint/commit/9f3121b228b9c066bff7a6011aecf269ac55f17c)) + + +### Features + +* [4.7] support instantiation expressions ([#4938](https://github.com/typescript-eslint/typescript-eslint/issues/4938)) ([79fbc77](https://github.com/typescript-eslint/typescript-eslint/commit/79fbc7743ae5dce3190f8168776e0204755390ad)) +* [4.7] support optional variance annotation ([#4831](https://github.com/typescript-eslint/typescript-eslint/issues/4831)) ([7e7b24c](https://github.com/typescript-eslint/typescript-eslint/commit/7e7b24c196e6d968e48f97f46feae5e7027e22d2)) + + + + + # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) **Note:** Version bump only for package @typescript-eslint/ast-spec diff --git a/packages/ast-spec/jest.config.js b/packages/ast-spec/jest.config.js index ac3b63608b7a..eeae64cb5dd4 100644 --- a/packages/ast-spec/jest.config.js +++ b/packages/ast-spec/jest.config.js @@ -4,10 +4,6 @@ /** @type {import('@jest/types').Config.InitialOptions} */ 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 1b605ffd02e8..cc762e151c85 100644 --- a/packages/ast-spec/package.json +++ b/packages/ast-spec/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/ast-spec", - "version": "5.25.0", + "version": "5.26.0", "description": "TypeScript-ESTree AST spec", "private": true, "keywords": [ diff --git a/packages/ast-spec/src/ast-node-types.ts b/packages/ast-spec/src/ast-node-types.ts index dec24662b22e..ff90dd1ee180 100644 --- a/packages/ast-spec/src/ast-node-types.ts +++ b/packages/ast-spec/src/ast-node-types.ts @@ -113,6 +113,7 @@ export enum AST_NODE_TYPES { TSExportKeyword = 'TSExportKeyword', TSExternalModuleReference = 'TSExternalModuleReference', TSFunctionType = 'TSFunctionType', + TSInstantiationExpression = 'TSInstantiationExpression', TSImportEqualsDeclaration = 'TSImportEqualsDeclaration', TSImportType = 'TSImportType', TSIndexedAccessType = 'TSIndexedAccessType', diff --git a/packages/ast-spec/src/base/ClassBase.ts b/packages/ast-spec/src/base/ClassBase.ts new file mode 100644 index 000000000000..4878cfc87b61 --- /dev/null +++ b/packages/ast-spec/src/base/ClassBase.ts @@ -0,0 +1,70 @@ +import type { Identifier } from '../expression/Identifier/spec'; +import type { ClassBody } from '../special/ClassBody/spec'; +import type { Decorator } from '../special/Decorator/spec'; +import type { TSClassImplements } from '../special/TSClassImplements/spec'; +import type { TSTypeParameterDeclaration } from '../special/TSTypeParameterDeclaration/spec'; +import type { TSTypeParameterInstantiation } from '../special/TSTypeParameterInstantiation/spec'; +import type { LeftHandSideExpression } from '../unions/LeftHandSideExpression'; +import type { BaseNode } from './BaseNode'; + +export interface ClassBase extends BaseNode { + /** + * Whether the class is an abstract class. + * ``` + * abstract class Foo {...} + * ``` + * This is always `undefined` for `ClassExpression`. + */ + // TODO(#5020) - make this `false` if it is not `abstract` + abstract?: boolean; + /** + * The class body. + */ + body: ClassBody; + /** + * Whether the class has been `declare`d: + * ``` + * declare class Foo {...} + * ``` + * This is always `undefined` for `ClassExpression`. + */ + // TODO(#5020) - make this `false` if it is not `declare`d + declare?: boolean; + /** + * The decorators declared for the class. + * This is `undefined` if there are no decorators. + * ``` + * @deco + * class Foo {...} + * ``` + * This is always `undefined` for `ClassExpression`. + */ + // TODO(#5020) - make this an empty array if there are none declared + decorators?: Decorator[]; + /** + * The class's name. + * - For a `ClassExpression` this may be `null` if the name is omitted. + * - For a `ClassDeclaration` this may be `null` if and only if the parent is + * an `ExportDefaultDeclaration`. + */ + id: Identifier | null; + /** + * The implemented interfaces for the class. + * This is `undefined` if there are no implemented interfaces. + */ + implements?: TSClassImplements[]; + /** + * The super class this class extends. + */ + superClass: LeftHandSideExpression | null; + /** + * The generic type parameters passed to the superClass. + * This is `undefined` if there are no generic type parameters passed. + */ + superTypeParameters?: TSTypeParameterInstantiation; + /** + * The generic type parameters declared for the class. + * This is `undefined` if there are no generic type parameters declared. + */ + typeParameters?: TSTypeParameterDeclaration; +} diff --git a/packages/ast-spec/src/base/ClassDeclarationBase.ts b/packages/ast-spec/src/base/ClassDeclarationBase.ts deleted file mode 100644 index f104b739b517..000000000000 --- a/packages/ast-spec/src/base/ClassDeclarationBase.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { Identifier } from '../expression/Identifier/spec'; -import type { ClassBody } from '../special/ClassBody/spec'; -import type { Decorator } from '../special/Decorator/spec'; -import type { TSClassImplements } from '../special/TSClassImplements/spec'; -import type { TSTypeParameterDeclaration } from '../special/TSTypeParameterDeclaration/spec'; -import type { TSTypeParameterInstantiation } from '../special/TSTypeParameterInstantiation/spec'; -import type { LeftHandSideExpression } from '../unions/LeftHandSideExpression'; -import type { BaseNode } from './BaseNode'; - -export interface ClassDeclarationBase extends BaseNode { - typeParameters?: TSTypeParameterDeclaration; - superTypeParameters?: TSTypeParameterInstantiation; - id: Identifier | null; - body: ClassBody; - superClass: LeftHandSideExpression | null; - implements?: TSClassImplements[]; - abstract?: boolean; - declare?: boolean; - decorators?: Decorator[]; -} diff --git a/packages/ast-spec/src/base/FunctionBase.ts b/packages/ast-spec/src/base/FunctionBase.ts new file mode 100644 index 000000000000..56446bc78ba9 --- /dev/null +++ b/packages/ast-spec/src/base/FunctionBase.ts @@ -0,0 +1,74 @@ +import type { Identifier } from '../expression/Identifier/spec'; +import type { TSTypeAnnotation } from '../special/TSTypeAnnotation/spec'; +import type { TSTypeParameterDeclaration } from '../special/TSTypeParameterDeclaration/spec'; +import type { BlockStatement } from '../statement/BlockStatement/spec'; +import type { Expression } from '../unions/Expression'; +import type { Parameter } from '../unions/Parameter'; +import type { BaseNode } from './BaseNode'; + +export interface FunctionBase extends BaseNode { + /** + * Whether the function is async: + * ``` + * async function foo(...) {...} + * const x = async function (...) {...} + * const x = async (...) => {...} + * ``` + */ + async: boolean; + /** + * The body of the function. + * - For an `ArrowFunctionExpression` this may be an `Expression` or `BlockStatement`. + * - For a `FunctionDeclaration` or `FunctionExpression` this is always a `BlockStatement. + * - For a `TSDeclareFunction` this is always `undefined`. + * - For a `TSEmptyBodyFunctionExpression` this is always `null`. + */ + body?: BlockStatement | Expression | null; + /** + * This is only `true` if and only if the node is a `TSDeclareFunction` and it has `declare`: + * ``` + * declare function foo(...) {...} + * ``` + */ + // TODO(#5020) - make this always `false` if it is not `declare`d instead of `undefined` + declare?: boolean; + /** + * This is only ever `true` if and only the node is an `ArrowFunctionExpression` and the body + * is an expression: + * ``` + * (() => 1) + * ``` + */ + expression: boolean; + /** + * Whether the function is a generator function: + * ``` + * function *foo(...) {...} + * const x = function *(...) {...} + * ``` + * This is always `false` for arrow functions as they cannot be generators. + */ + generator: boolean; + /** + * The function's name. + * - For an `ArrowFunctionExpression` this is always `null`. + * - For a `FunctionExpression` this may be `null` if the name is omitted. + * - For a `FunctionDeclaration` or `TSDeclareFunction` this may be `null` if + * and only if the parent is an `ExportDefaultDeclaration`. + */ + id: Identifier | null; + /** + * The list of parameters declared for the function. + */ + params: Parameter[]; + /** + * The return type annotation for the function. + * This is `undefined` if there is no return type declared. + */ + returnType?: TSTypeAnnotation; + /** + * The generic type parameter declaration for the function. + * This is `undefined` if there are no generic type parameters declared. + */ + typeParameters?: TSTypeParameterDeclaration; +} diff --git a/packages/ast-spec/src/base/FunctionDeclarationBase.ts b/packages/ast-spec/src/base/FunctionDeclarationBase.ts deleted file mode 100644 index 50b7aa97bf2f..000000000000 --- a/packages/ast-spec/src/base/FunctionDeclarationBase.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { Identifier } from '../expression/Identifier/spec'; -import type { TSTypeAnnotation } from '../special/TSTypeAnnotation/spec'; -import type { TSTypeParameterDeclaration } from '../special/TSTypeParameterDeclaration/spec'; -import type { BlockStatement } from '../statement/BlockStatement/spec'; -import type { Parameter } from '../unions/Parameter'; -import type { BaseNode } from './BaseNode'; - -export interface FunctionDeclarationBase extends BaseNode { - id: Identifier | null; - generator: boolean; - expression: boolean; - async: boolean; - params: Parameter[]; - body?: BlockStatement | null; - returnType?: TSTypeAnnotation; - typeParameters?: TSTypeParameterDeclaration; - declare?: boolean; -} diff --git a/packages/ast-spec/src/base/TSHeritageBase.ts b/packages/ast-spec/src/base/TSHeritageBase.ts index 5c20542e4f92..683600ec01d3 100644 --- a/packages/ast-spec/src/base/TSHeritageBase.ts +++ b/packages/ast-spec/src/base/TSHeritageBase.ts @@ -3,7 +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 + // TODO(#1852) - this should be restricted to MemberExpression | Identifier expression: Expression; typeParameters?: TSTypeParameterInstantiation; } diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/fixture.ts similarity index 100% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/fixture.ts rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/fixture.ts diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..c17328b32e82 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ missing-body TSESTree - Error 1`] = `[TSError: '{' expected.]`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..4f8ef959d9ba --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ missing-body Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:9)]`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..18e4442401e0 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-body/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ missing-body Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/fixture.ts new file mode 100644 index 000000000000..83ffb99a72bd --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/fixture.ts @@ -0,0 +1 @@ +class C extends D<> {} diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..4f99d71eb953 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ missing-extends-type-param TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..f84357321316 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ missing-extends-type-param Babel - Error 1`] = `[SyntaxError: Type argument list cannot be empty. (1:17)]`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..35683b841219 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-extends-type-param/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ missing-extends-type-param Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/fixture.ts new file mode 100644 index 000000000000..4f3d75967f9b --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/fixture.ts @@ -0,0 +1 @@ +class C<> {} diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..9682f9c4373e --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ missing-type-param TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..a14c3c54cac7 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ missing-type-param Babel - Error 1`] = `[SyntaxError: Type parameter list cannot be empty. (1:7)]`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..49567ea7a7b5 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ missing-type-param Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; 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 deleted file mode 100644 index 305258435809..000000000000 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/snapshots/1-TSESTree-Error.shot +++ /dev/null @@ -1,3 +0,0 @@ -// 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 deleted file mode 100644 index e72c371e8425..000000000000 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/snapshots/2-Babel-Error.shot +++ /dev/null @@ -1,3 +0,0 @@ -// 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 deleted file mode 100644 index b69460232224..000000000000 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/no-body/snapshots/3-Alignment-Error.shot +++ /dev/null @@ -1,3 +0,0 @@ -// 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-type-param/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/fixture.ts new file mode 100644 index 000000000000..383479818e60 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/fixture.ts @@ -0,0 +1 @@ +class C<1> {} diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..0be64ad34736 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ non-identifier-type-param TSESTree - Error 1`] = `[TSError: Type parameter declaration expected.]`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..6ef9a4c481a7 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ non-identifier-type-param Babel - Error 1`] = `[SyntaxError: Unexpected token (1:8)]`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..98c58289073e --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration _error_ non-identifier-type-param Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/fixture.ts similarity index 100% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/fixture.ts rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/fixture.ts diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/1-TSESTree-AST.shot similarity index 95% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/1-TSESTree-AST.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/1-TSESTree-AST.shot index ab7726fcd526..7f37d13c4882 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/1-TSESTree-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration decoratorMany TSESTree - AST 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration decorator-many TSESTree - AST 1`] = ` Program { type: "Program", body: Array [ diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/2-TSESTree-Tokens.shot similarity index 94% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/2-TSESTree-Tokens.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/2-TSESTree-Tokens.shot index f406c8123352..5f64c50c3bdc 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/2-TSESTree-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration decoratorMany TSESTree - Tokens 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration decorator-many TSESTree - Tokens 1`] = ` Array [ Punctuator { type: "Punctuator", diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/3-Babel-AST.shot similarity index 95% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/3-Babel-AST.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/3-Babel-AST.shot index 60af58e326d3..3c94fd556d00 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/3-Babel-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration decoratorMany Babel - AST 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration decorator-many Babel - AST 1`] = ` Program { type: "Program", body: Array [ diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/4-Babel-Tokens.shot similarity index 94% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/4-Babel-Tokens.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/4-Babel-Tokens.shot index 888d2f213d3f..e7d7dba3776b 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration decoratorMany Babel - Tokens 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration decorator-many Babel - Tokens 1`] = ` Array [ Punctuator { type: "Punctuator", diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..751a6cc951f0 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration decorator-many AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..338a8838194e --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-many/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration decorator-many 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/decorator-one/fixture.ts similarity index 100% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/fixture.ts rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/fixture.ts diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/1-TSESTree-AST.shot similarity index 93% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/1-TSESTree-AST.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/1-TSESTree-AST.shot index f0550dcabbe8..aba5fc9308df 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/1-TSESTree-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration decoratorOne TSESTree - AST 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration decorator-one TSESTree - AST 1`] = ` Program { type: "Program", body: Array [ diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/2-TSESTree-Tokens.shot similarity index 92% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/2-TSESTree-Tokens.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/2-TSESTree-Tokens.shot index 7354a4e9bfed..7d75dd277906 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/2-TSESTree-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration decoratorOne TSESTree - Tokens 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration decorator-one TSESTree - Tokens 1`] = ` Array [ Punctuator { type: "Punctuator", diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/3-Babel-AST.shot similarity index 94% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/3-Babel-AST.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/3-Babel-AST.shot index f2e4581ba588..9f91cb39e807 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/3-Babel-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration decoratorOne Babel - AST 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration decorator-one Babel - AST 1`] = ` Program { type: "Program", body: Array [ diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/4-Babel-Tokens.shot similarity index 92% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/4-Babel-Tokens.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/4-Babel-Tokens.shot index eb1816cba73b..3b6aa60b33d6 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration decoratorOne Babel - Tokens 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration decorator-one Babel - Tokens 1`] = ` Array [ Punctuator { type: "Punctuator", 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/decorator-one/snapshots/5-AST-Alignment-AST.shot similarity index 68% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/5-AST-Alignment-AST.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/5-AST-Alignment-AST.shot index 97881c1404c3..503bd4f5ad82 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/5-AST-Alignment-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration decoratorMany AST Alignment - AST 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration decorator-one 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/decorator-one/snapshots/6-AST-Alignment-Tokens.shot similarity index 68% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/6-AST-Alignment-Tokens.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/6-AST-Alignment-Tokens.shot index e57e9fa7313b..1ab8923d733f 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorMany/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decorator-one/snapshots/6-AST-Alignment-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration decoratorMany AST Alignment - Token 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration decorator-one 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-param/fixture.ts similarity index 100% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/fixture.ts rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/fixture.ts 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-param/snapshots/1-TSESTree-AST.shot similarity index 97% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/1-TSESTree-AST.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/1-TSESTree-AST.shot index da9fc3ba5ca5..43fbb02d6c00 100644 --- 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-param/snapshots/1-TSESTree-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration extends-type-parameters TSESTree - AST 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration extends-type-param TSESTree - AST 1`] = ` Program { type: "Program", body: Array [ 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-param/snapshots/2-TSESTree-Tokens.shot similarity index 97% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/2-TSESTree-Tokens.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/2-TSESTree-Tokens.shot index 3eb2b515a24e..c0ea9a808468 100644 --- 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-param/snapshots/2-TSESTree-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration extends-type-parameters TSESTree - Tokens 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration extends-type-param TSESTree - Tokens 1`] = ` Array [ Keyword { type: "Keyword", 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-param/snapshots/3-Babel-AST.shot similarity index 98% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/3-Babel-AST.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/3-Babel-AST.shot index 8f9634b6629e..2071afa4c8e0 100644 --- 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-param/snapshots/3-Babel-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration extends-type-parameters Babel - AST 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration extends-type-param Babel - AST 1`] = ` Program { type: "Program", body: Array [ 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-param/snapshots/4-Babel-Tokens.shot similarity index 98% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/4-Babel-Tokens.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/4-Babel-Tokens.shot index db93259e13a5..a19207090a5f 100644 --- 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-param/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration extends-type-parameters Babel - Tokens 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration extends-type-param Babel - Tokens 1`] = ` Array [ Keyword { type: "Keyword", 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-param/snapshots/5-AST-Alignment-AST.shot similarity index 81% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/5-AST-Alignment-AST.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/5-AST-Alignment-AST.shot index 17f60ddc36a5..d7a16a19520a 100644 --- 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-param/snapshots/5-AST-Alignment-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration extends-type-parameters AST Alignment - AST 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration extends-type-param 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-param/snapshots/6-AST-Alignment-Tokens.shot similarity index 80% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-parameters/snapshots/6-AST-Alignment-Tokens.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/extends-type-param/snapshots/6-AST-Alignment-Tokens.shot index 8c6277e35df2..e231ba6210a9 100644 --- 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-param/snapshots/6-AST-Alignment-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration extends-type-parameters AST Alignment - Token 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration extends-type-param 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-param/fixture.ts similarity index 100% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/fixture.ts rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/fixture.ts 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-param/snapshots/1-TSESTree-AST.shot similarity index 92% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/1-TSESTree-AST.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/1-TSESTree-AST.shot index 0b476f5584ed..13f2fe48ba0d 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/1-TSESTree-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/1-TSESTree-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration type-parameters TSESTree - AST 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration type-param TSESTree - AST 1`] = ` Program { type: "Program", body: Array [ @@ -32,6 +32,7 @@ Program { params: Array [ TSTypeParameter { type: "TSTypeParameter", + in: false, name: Identifier { type: "Identifier", name: "T", @@ -42,6 +43,7 @@ Program { end: { column: 11, line: 1 }, }, }, + out: false, range: [10, 11], loc: { 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-param/snapshots/2-TSESTree-Tokens.shot similarity index 93% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/2-TSESTree-Tokens.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/2-TSESTree-Tokens.shot index 7afa2b8839ba..4b814b828291 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/2-TSESTree-Tokens.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/2-TSESTree-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration type-parameters TSESTree - Tokens 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration type-param TSESTree - Tokens 1`] = ` Array [ Keyword { type: "Keyword", 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-param/snapshots/3-Babel-AST.shot similarity index 94% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/3-Babel-AST.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/3-Babel-AST.shot index de9ab22cc6b9..288661b13116 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/3-Babel-AST.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/3-Babel-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration type-parameters Babel - AST 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration type-param Babel - AST 1`] = ` Program { type: "Program", body: Array [ 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-param/snapshots/4-Babel-Tokens.shot similarity index 93% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/4-Babel-Tokens.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/4-Babel-Tokens.shot index 89bca663a6db..27db70bb89e0 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/4-Babel-Tokens.shot +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration type-parameters Babel - Tokens 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration type-param Babel - Tokens 1`] = ` Array [ Keyword { type: "Keyword", 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-param/snapshots/5-AST-Alignment-AST.shot similarity index 92% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/5-AST-Alignment-AST.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/5-AST-Alignment-AST.shot index f3b75ecbb25a..0ee9dbba0359 100644 --- 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-param/snapshots/5-AST-Alignment-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration type-parameters AST Alignment - AST 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration type-param AST Alignment - AST 1`] = ` "Snapshot Diff: - TSESTree + Babel @@ -36,6 +36,7 @@ exports[`AST Fixtures declaration ClassDeclaration type-parameters AST Alignment params: Array [ TSTypeParameter { type: 'TSTypeParameter', +- in: false, - name: Identifier { - type: 'Identifier', - name: 'T', @@ -46,6 +47,7 @@ exports[`AST Fixtures declaration ClassDeclaration type-parameters AST Alignment - end: { column: 11, line: 1 }, - }, - }, +- out: false, + name: 'T', range: [10, 11], diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..581d856705d2 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-param/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration type-param AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; 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-param/fixture.ts similarity index 100% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/fixture.ts rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/fixture.ts 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-param/snapshots/1-TSESTree-AST.shot similarity index 96% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/1-TSESTree-AST.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/1-TSESTree-AST.shot index 7fa282280172..aac248040d84 100644 --- 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-param/snapshots/1-TSESTree-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type-parameters TSESTree - AST 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type-param TSESTree - AST 1`] = ` Program { type: "Program", body: Array [ @@ -71,6 +71,7 @@ Program { params: Array [ TSTypeParameter { type: "TSTypeParameter", + in: false, name: Identifier { type: "Identifier", name: "T", @@ -81,6 +82,7 @@ Program { end: { column: 11, line: 1 }, }, }, + out: false, range: [10, 11], loc: { 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-param/snapshots/2-TSESTree-Tokens.shot similarity index 97% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/2-TSESTree-Tokens.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/2-TSESTree-Tokens.shot index f73a167dba3e..f697768aad0d 100644 --- 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-param/snapshots/2-TSESTree-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type-parameters TSESTree - Tokens 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type-param TSESTree - Tokens 1`] = ` Array [ Keyword { type: "Keyword", 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-param/snapshots/3-Babel-AST.shot similarity index 98% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/3-Babel-AST.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/3-Babel-AST.shot index 7c5a5149bbed..e5856d26fbc8 100644 --- 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-param/snapshots/3-Babel-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type-parameters Babel - AST 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type-param Babel - AST 1`] = ` Program { type: "Program", body: Array [ 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-param/snapshots/4-Babel-Tokens.shot similarity index 97% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/4-Babel-Tokens.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/4-Babel-Tokens.shot index 17ca652dc4a9..97d16c68e189 100644 --- 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-param/snapshots/4-Babel-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type-parameters Babel - Tokens 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type-param Babel - Tokens 1`] = ` Array [ Keyword { type: "Keyword", 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-param/snapshots/5-AST-Alignment-AST.shot similarity index 96% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/5-AST-Alignment-AST.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/5-AST-Alignment-AST.shot index 70cae74b3003..f6d5a3c73b31 100644 --- 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-param/snapshots/5-AST-Alignment-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type-parameters AST Alignment - AST 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type-param AST Alignment - AST 1`] = ` "Snapshot Diff: - TSESTree + Babel @@ -75,6 +75,7 @@ exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type- params: Array [ TSTypeParameter { type: 'TSTypeParameter', +- in: false, - name: Identifier { - type: 'Identifier', - name: 'T', @@ -85,6 +86,7 @@ exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type- - end: { column: 11, line: 1 }, - }, - }, +- out: false, + name: 'T', range: [10, 11], 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-extends-type-param/snapshots/6-AST-Alignment-Tokens.shot similarity index 76% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters/snapshots/6-AST-Alignment-Tokens.shot rename to packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/snapshots/6-AST-Alignment-Tokens.shot index a99d685df3d6..01862c4c7514 100644 --- 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-extends-type-param/snapshots/6-AST-Alignment-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration type-parameters AST Alignment - Token 1`] = ` +exports[`AST Fixtures declaration ClassDeclaration type-parameters-extends-type-param AST Alignment - Token 1`] = ` "Snapshot Diff: Compared values have no visual difference." `; 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 deleted file mode 100644 index 4e5329e739f9..000000000000 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/type-parameters-extends-type-parameters/snapshots/6-AST-Alignment-Tokens.shot +++ /dev/null @@ -1,6 +0,0 @@ -// 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/with-member-one/fixture.ts b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/fixture.ts new file mode 100644 index 000000000000..b790f0b57f60 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/fixture.ts @@ -0,0 +1,3 @@ +class Foo { + prop; +} diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..bdbfa5822bb2 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,71 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration with-member-one TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + PropertyDefinition { + type: "PropertyDefinition", + computed: false, + declare: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [14, 18], + loc: { + start: { column: 2, line: 2 }, + end: { column: 6, line: 2 }, + }, + }, + override: false, + static: false, + value: null, + + range: [14, 19], + loc: { + start: { column: 2, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + ], + + range: [10, 21], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..1184bd1ae083 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration with-member-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 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [14, 18], + loc: { + start: { column: 2, line: 2 }, + end: { column: 6, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [18, 19], + loc: { + start: { column: 6, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [20, 21], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..df5b728f5588 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/3-Babel-AST.shot @@ -0,0 +1,69 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration with-member-one Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ClassDeclaration { + type: "ClassDeclaration", + body: ClassBody { + type: "ClassBody", + body: Array [ + PropertyDefinition { + type: "PropertyDefinition", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [14, 18], + loc: { + start: { column: 2, line: 2 }, + end: { column: 6, line: 2 }, + }, + }, + static: false, + value: null, + + range: [14, 19], + loc: { + start: { column: 2, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + ], + + range: [10, 21], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..3fe5916a116c --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration with-member-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 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [14, 18], + loc: { + start: { column: 2, line: 2 }, + end: { column: 6, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [18, 19], + loc: { + start: { column: 6, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [20, 21], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..121e647439e9 --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,75 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration with-member-one AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + ClassDeclaration { + type: 'ClassDeclaration', + body: ClassBody { + type: 'ClassBody', + body: Array [ + PropertyDefinition { + type: 'PropertyDefinition', + computed: false, +- declare: false, + key: Identifier { + type: 'Identifier', + name: 'prop', + + range: [14, 18], + loc: { + start: { column: 2, line: 2 }, + end: { column: 6, line: 2 }, + }, + }, +- override: false, + static: false, + value: null, + + range: [14, 19], + loc: { + start: { column: 2, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + ], + + range: [10, 21], + loc: { + start: { column: 10, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'Foo', + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + superClass: null, + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..89d6bb8a18ea --- /dev/null +++ b/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/with-member-one/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ClassDeclaration with-member-one AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ClassDeclaration/spec.ts b/packages/ast-spec/src/declaration/ClassDeclaration/spec.ts index 2154b8863a02..50112b70b5e1 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/ClassDeclaration/spec.ts @@ -1,6 +1,19 @@ import type { AST_NODE_TYPES } from '../../ast-node-types'; -import type { ClassDeclarationBase } from '../../base/ClassDeclarationBase'; +import type { ClassBase } from '../../base/ClassBase'; +import type { Identifier } from '../../expression/Identifier/spec'; -export interface ClassDeclaration extends ClassDeclarationBase { +interface ClassDeclarationBase extends ClassBase { type: AST_NODE_TYPES.ClassDeclaration; } + +export interface ClassDeclarationWithName extends ClassDeclarationBase { + id: Identifier; +} + +export interface ClassDeclarationWithOptionalName extends ClassDeclarationBase { + id: Identifier | null; +} + +export type ClassDeclaration = + | ClassDeclarationWithName + | ClassDeclarationWithOptionalName; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/fixture.ts b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/fixture.ts new file mode 100644 index 000000000000..0a8ce4f553c8 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/fixture.ts @@ -0,0 +1 @@ +export type * as x from 'a'; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..4e1ab2405d45 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,48 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration kind-type TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ExportAllDeclaration { + type: "ExportAllDeclaration", + assertions: Array [], + exported: Identifier { + type: "Identifier", + name: "x", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + exportKind: "type", + source: Literal { + type: "Literal", + raw: "'a'", + value: "a", + + range: [24, 27], + loc: { + start: { column: 24, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..a28f9c4f9032 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ kind-type TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..18b68176cbec --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ kind-type Babel - Error 1`] = `[SyntaxError: Unexpected token (1:12)]`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..f5bfa8f5615e --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration kind-type 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 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "*", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "as", + + range: [14, 16], + loc: { + start: { column: 14, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [19, 23], + loc: { + start: { column: 19, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + String { + type: "String", + value: "'a'", + + 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..f9e05e0f6ea8 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/kind-type/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ kind-type Error Alignment 1`] = `"Babel errored but TSESTree 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_/missing-source/fixture.ts similarity index 100% rename from packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/no-source/fixture.ts rename to packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/missing-source/fixture.ts diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/missing-source/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/missing-source/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..d3c411c7ec3a --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/missing-source/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ missing-source TSESTree - Error 1`] = `[TSError: Expression expected.]`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/missing-source/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/missing-source/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..b45b0c8fc850 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/missing-source/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ missing-source Babel - Error 1`] = `[SyntaxError: Unexpected token (1:13)]`; diff --git a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/missing-source/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/missing-source/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..89889f0ae319 --- /dev/null +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/missing-source/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ExportAllDeclaration _error_ missing-source Error Alignment 1`] = `"Both errored"`; 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 deleted file mode 100644 index acdaf4c735f9..000000000000 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/no-source/snapshots/1-TSESTree-Error.shot +++ /dev/null @@ -1,3 +0,0 @@ -// 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 deleted file mode 100644 index 8bd09ace8dc6..000000000000 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/no-source/snapshots/2-Babel-Error.shot +++ /dev/null @@ -1,3 +0,0 @@ -// 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 deleted file mode 100644 index c2ac962baac0..000000000000 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/fixtures/_error_/no-source/snapshots/3-Alignment-Error.shot +++ /dev/null @@ -1,3 +0,0 @@ -// 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/spec.ts b/packages/ast-spec/src/declaration/ExportAllDeclaration/spec.ts index 5cf3301a50db..168f7b40b611 100644 --- a/packages/ast-spec/src/declaration/ExportAllDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/ExportAllDeclaration/spec.ts @@ -7,8 +7,24 @@ import type { ExportKind } from '../ExportAndImportKind'; export interface ExportAllDeclaration extends BaseNode { type: AST_NODE_TYPES.ExportAllDeclaration; - source: StringLiteral | null; - exportKind: ExportKind; - exported: Identifier | null; + /** + * The assertions declared for the export. + * ``` + * export * from 'mod' assert { type: 'json' }; + * ``` + */ assertions: ImportAttribute[]; + /** + * The name for the exported items. `null` if no name is assigned. + */ + exported: Identifier | null; + /** + * The kind of the export. + */ + // TODO(#1852) - breaking change remove this because it is a semantic error to have it + exportKind: ExportKind; + /** + * The source module being exported from. + */ + source: StringLiteral; } diff --git a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/spec.ts b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/spec.ts index 2cfe1cce5b33..51b1248854a8 100644 --- a/packages/ast-spec/src/declaration/ExportDefaultDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/ExportDefaultDeclaration/spec.ts @@ -1,15 +1,16 @@ import type { AST_NODE_TYPES } from '../../ast-node-types'; import type { BaseNode } from '../../base/BaseNode'; -import type { ExportDeclaration } from '../../unions/ExportDeclaration'; -import type { Expression } from '../../unions/Expression'; +import type { DefaultExportDeclarations } from '../../unions/ExportDeclaration'; import type { ExportKind } from '../ExportAndImportKind'; export interface ExportDefaultDeclaration extends BaseNode { type: AST_NODE_TYPES.ExportDefaultDeclaration; - declaration: - | // TODO(error handling) - the following are disallowed syntactically, but allowed by TS error recovery: - // TSEnumDeclaration, TSModuleDeclaration, TSTypeAliasDeclaration, VariableDeclaration - ExportDeclaration - | Expression; + /** + * The declaration being exported. + */ + declaration: DefaultExportDeclarations; + /** + * The kind of the export. + */ exportKind: ExportKind; } diff --git a/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts b/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts index 3e2989b74990..061c53f4b469 100644 --- a/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/ExportNamedDeclaration/spec.ts @@ -3,15 +3,73 @@ import type { BaseNode } from '../../base/BaseNode'; import type { StringLiteral } from '../../expression/literal/StringLiteral/spec'; import type { ExportSpecifier } from '../../special/ExportSpecifier/spec'; import type { ImportAttribute } from '../../special/ImportAttribute/spec'; -import type { ExportDeclaration } from '../../unions/ExportDeclaration'; +import type { NamedExportDeclarations } from '../../unions/ExportDeclaration'; import type { ExportKind } from '../ExportAndImportKind'; -export interface ExportNamedDeclaration extends BaseNode { +interface ExportNamedDeclarationBase extends BaseNode { type: AST_NODE_TYPES.ExportNamedDeclaration; - // TODO(error handling) - ClassExpression is not valid here - declaration: ExportDeclaration | null; - specifiers: ExportSpecifier[]; - source: StringLiteral | null; + /** + * The assertions declared for the export. + * ``` + * export { foo } from 'mod' assert { type: 'json' }; + * ``` + * This will be an empty array if `source` is `null` + */ + assertions: ImportAttribute[]; + /** + * The exported declaration. + * ``` + * export const x = 1; + * ``` + * This will be `null` if `source` is not `null`, or if there are `specifiers` + */ + declaration: NamedExportDeclarations | null; + /** + * The kind of the export. + */ exportKind: ExportKind; + /** + * The source module being exported from. + */ + source: StringLiteral | null; + /** + * The specifiers being exported. + * ``` + * export { a, b }; + * ``` + * This will be an empty array if `declaration` is not `null` + */ + specifiers: ExportSpecifier[]; +} + +export interface ExportNamedDeclarationWithoutSourceWithMultiple + extends ExportNamedDeclarationBase { + // this will always be empty array assertions: ImportAttribute[]; + declaration: NamedExportDeclarations; + source: null; + specifiers: ExportSpecifier[]; } + +export interface ExportNamedDeclarationWithoutSourceWithSingle + extends ExportNamedDeclarationBase { + // this will always be empty array + assertions: ImportAttribute[]; + declaration: null; + source: null; + // this will always be empty array + specifiers: ExportSpecifier[]; +} + +export interface ExportNamedDeclarationWithSource + extends ExportNamedDeclarationBase { + assertions: ImportAttribute[]; + declaration: null; + source: StringLiteral; + specifiers: ExportSpecifier[]; +} + +export type ExportNamedDeclaration = + | ExportNamedDeclarationWithoutSourceWithMultiple + | ExportNamedDeclarationWithoutSourceWithSingle + | ExportNamedDeclarationWithSource; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/fixture.ts b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/fixture.ts new file mode 100644 index 000000000000..6c532730c0b4 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/fixture.ts @@ -0,0 +1 @@ +function () {} diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..e8630b3f99ce --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration _error_ missing-id-and-not-exported TSESTree - Error 1`] = `[TSError: Identifier expected.]`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..d0110ccac63f --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration _error_ missing-id-and-not-exported Babel - Error 1`] = `[SyntaxError: Unexpected token (1:9)]`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..adae3f26337b --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-id-and-not-exported/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration _error_ missing-id-and-not-exported Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/fixture.ts b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/fixture.ts new file mode 100644 index 000000000000..0988137a7e71 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/fixture.ts @@ -0,0 +1 @@ +function foo<>() {} diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..2ffb9878bc95 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration _error_ missing-type-param TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..83a2a868f15a --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration _error_ missing-type-param Babel - Error 1`] = `[SyntaxError: Type parameter list cannot be empty. (1:12)]`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..04a70d3af29f --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration _error_ missing-type-param Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-name/fixture.ts b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-name/fixture.ts new file mode 100644 index 000000000000..4e06a77dc7f5 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-name/fixture.ts @@ -0,0 +1 @@ +function 1() {} diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..156bebb725cf --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/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 FunctionDeclaration _error_ non-identifier-name TSESTree - Error 1`] = `[TSError: Identifier expected.]`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..d23f3eff9555 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/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 FunctionDeclaration _error_ non-identifier-name Babel - Error 1`] = `[SyntaxError: Unexpected token (1:9)]`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-name/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-name/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..f34f77cd1b85 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/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 FunctionDeclaration _error_ non-identifier-name Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/fixture.ts b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/fixture.ts new file mode 100644 index 000000000000..99644e47f365 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/fixture.ts @@ -0,0 +1 @@ +function foo<1>() {} diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..8c643863afba --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration _error_ non-identifier-type-param TSESTree - Error 1`] = `[TSError: Type parameter declaration expected.]`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..8be1b8d27a37 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration _error_ non-identifier-type-param Babel - Error 1`] = `[SyntaxError: Unexpected token (1:13)]`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..f2b863d8647a --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration _error_ non-identifier-type-param Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/fixture.ts b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/fixture.ts new file mode 100644 index 000000000000..f9df9686dd67 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/fixture.ts @@ -0,0 +1 @@ +async function foo() {} diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..7a7cd7ea28a3 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,49 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration async TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + FunctionDeclaration { + type: "FunctionDeclaration", + async: true, + body: BlockStatement { + type: "BlockStatement", + body: Array [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + params: Array [], + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..3ca43d1e9fa1 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration async TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "async", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "function", + + range: [6, 14], + loc: { + start: { column: 6, 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: [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 }, + }, + }, + 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/FunctionDeclaration/fixtures/async/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..c24f3da9207c --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/3-Babel-AST.shot @@ -0,0 +1,49 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration async Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + FunctionDeclaration { + type: "FunctionDeclaration", + async: true, + body: BlockStatement { + type: "BlockStatement", + body: Array [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + params: Array [], + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..22c009c000f1 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration async Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "async", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "function", + + range: [6, 14], + loc: { + start: { column: 6, 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: [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 }, + }, + }, + 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/FunctionDeclaration/fixtures/async/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..fe3cf227fbae --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration async AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..b7e2ed7bd9aa --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/async/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration async AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/fixture.ts b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/fixture.ts new file mode 100644 index 000000000000..b0400ee9b26e --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/fixture.ts @@ -0,0 +1 @@ +function foo() {} diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..e21b80de90ed --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,49 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration empty TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + FunctionDeclaration { + type: "FunctionDeclaration", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: Array [], + + range: [15, 17], + loc: { + start: { column: 15, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [], + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..d53355506df5 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration empty TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "function", + + range: [0, 8], + loc: { + start: { column: 0, 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: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, 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: [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/FunctionDeclaration/fixtures/empty/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..e339b4afda47 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/3-Babel-AST.shot @@ -0,0 +1,49 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration empty Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + FunctionDeclaration { + type: "FunctionDeclaration", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: Array [], + + range: [15, 17], + loc: { + start: { column: 15, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [], + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..0b7e51f42351 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration empty Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "function", + + range: [0, 8], + loc: { + start: { column: 0, 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: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, 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: [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/FunctionDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..b08265806b56 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration empty AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..de6b3f7e1164 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/empty/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration empty AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/fixture.ts b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/fixture.ts new file mode 100644 index 000000000000..f60d20a34b7e --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/fixture.ts @@ -0,0 +1 @@ +function* foo() {} diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..7ad2d7a2dcef --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,49 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration generator TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + FunctionDeclaration { + type: "FunctionDeclaration", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: Array [], + + range: [16, 18], + loc: { + start: { column: 16, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + expression: false, + generator: true, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + params: Array [], + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..d6d229236840 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration generator TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "function", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "*", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, 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 }, + }, + }, + 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/FunctionDeclaration/fixtures/generator/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..46d3edd3250d --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/3-Babel-AST.shot @@ -0,0 +1,49 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration generator Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + FunctionDeclaration { + type: "FunctionDeclaration", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: Array [], + + range: [16, 18], + loc: { + start: { column: 16, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + expression: false, + generator: true, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + params: Array [], + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..3fb7fa84513a --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration generator Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "function", + + range: [0, 8], + loc: { + start: { column: 0, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "*", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [10, 13], + loc: { + start: { column: 10, line: 1 }, + end: { column: 13, 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 }, + }, + }, + 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/ClassDeclaration/fixtures/decoratorOne/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/5-AST-Alignment-AST.shot similarity index 67% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/5-AST-Alignment-AST.shot rename to packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/5-AST-Alignment-AST.shot index 19b8f62ee26d..e94e87d038a4 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/5-AST-Alignment-AST.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/5-AST-Alignment-AST.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration decoratorOne AST Alignment - AST 1`] = ` +exports[`AST Fixtures declaration FunctionDeclaration generator 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/FunctionDeclaration/fixtures/generator/snapshots/6-AST-Alignment-Tokens.shot similarity index 68% rename from packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/6-AST-Alignment-Tokens.shot rename to packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/6-AST-Alignment-Tokens.shot index 915fd1d51f92..033a7496b3cb 100644 --- a/packages/ast-spec/src/declaration/ClassDeclaration/fixtures/decoratorOne/snapshots/6-AST-Alignment-Tokens.shot +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/generator/snapshots/6-AST-Alignment-Tokens.shot @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`AST Fixtures declaration ClassDeclaration decoratorOne AST Alignment - Token 1`] = ` +exports[`AST Fixtures declaration FunctionDeclaration generator AST Alignment - Token 1`] = ` "Snapshot Diff: Compared values have no visual difference." `; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/fixture.ts b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/fixture.ts new file mode 100644 index 000000000000..8dca93172ea8 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/fixture.ts @@ -0,0 +1 @@ +function foo(a, b, c) {} diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..9a6db3d1c4c8 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration param-many TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + FunctionDeclaration { + type: "FunctionDeclaration", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: Array [], + + range: [22, 24], + loc: { + start: { column: 22, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [ + Identifier { + type: "Identifier", + name: "a", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + name: "b", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + name: "c", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..08de97f6423d --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration param-many TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "function", + + range: [0, 8], + loc: { + start: { column: 0, 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: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "b", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "c", + + 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/FunctionDeclaration/fixtures/param-many/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..c04ed8242841 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/3-Babel-AST.shot @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration param-many Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + FunctionDeclaration { + type: "FunctionDeclaration", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: Array [], + + range: [22, 24], + loc: { + start: { column: 22, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [ + Identifier { + type: "Identifier", + name: "a", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + name: "b", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + name: "c", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..a0aa44879941 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration param-many Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "function", + + range: [0, 8], + loc: { + start: { column: 0, 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: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "b", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "c", + + 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/FunctionDeclaration/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..f8b80c46b1e6 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration param-many AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..70640eb186a9 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-many/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration param-many AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/fixture.ts b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/fixture.ts new file mode 100644 index 000000000000..ef1dd099d3f1 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/fixture.ts @@ -0,0 +1 @@ +function foo(a) {} diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..99d9cdc9e989 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,60 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration param-one TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + FunctionDeclaration { + type: "FunctionDeclaration", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: Array [], + + range: [16, 18], + loc: { + start: { column: 16, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [ + Identifier { + type: "Identifier", + name: "a", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..81f8b5dc7518 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration param-one TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "function", + + range: [0, 8], + loc: { + start: { column: 0, 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: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + 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 }, + }, + }, + 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/FunctionDeclaration/fixtures/param-one/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..6e503e760fb6 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/3-Babel-AST.shot @@ -0,0 +1,60 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration param-one Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + FunctionDeclaration { + type: "FunctionDeclaration", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: Array [], + + range: [16, 18], + loc: { + start: { column: 16, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [ + Identifier { + type: "Identifier", + name: "a", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..802761abb0ee --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration param-one Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "function", + + range: [0, 8], + loc: { + start: { column: 0, 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: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + 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 }, + }, + }, + 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/FunctionDeclaration/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..5c75a74de72a --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration param-one AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..f6f408e32c2c --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/param-one/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration param-one AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/fixture.ts b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/fixture.ts new file mode 100644 index 000000000000..4fa04cdbc0b2 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/fixture.ts @@ -0,0 +1 @@ +function foo(): void {} diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..d9d3eccf8d7f --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,67 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration returnType TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + FunctionDeclaration { + type: "FunctionDeclaration", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: Array [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [], + returnType: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSVoidKeyword { + type: "TSVoidKeyword", + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [14, 20], + loc: { + start: { column: 14, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..d3930ccf8dcf --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration returnType TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "function", + + range: [0, 8], + loc: { + start: { column: 0, 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: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, 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 }, + }, + }, + Keyword { + type: "Keyword", + value: "void", + + range: [16, 20], + loc: { + start: { column: 16, 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/FunctionDeclaration/fixtures/returnType/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..8f9c235c4292 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/3-Babel-AST.shot @@ -0,0 +1,67 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration returnType Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + FunctionDeclaration { + type: "FunctionDeclaration", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: Array [], + + range: [21, 23], + loc: { + start: { column: 21, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [], + returnType: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSVoidKeyword { + type: "TSVoidKeyword", + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [14, 20], + loc: { + start: { column: 14, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..0c94d7108ae4 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration returnType Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "function", + + range: [0, 8], + loc: { + start: { column: 0, 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: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, 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 }, + }, + }, + Keyword { + type: "Keyword", + value: "void", + + range: [16, 20], + loc: { + start: { column: 16, 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/FunctionDeclaration/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..d0df21058e9f --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration returnType AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..0a4b02ae4245 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/returnType/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration returnType AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/fixture.ts b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/fixture.ts new file mode 100644 index 000000000000..36ddc225d14c --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/fixture.ts @@ -0,0 +1 @@ +function foo() {} diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..24eae0d32901 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,123 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration type-param-many TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + FunctionDeclaration { + type: "FunctionDeclaration", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: Array [], + + range: [24, 26], + loc: { + start: { column: 24, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [], + typeParameters: TSTypeParameterDeclaration { + type: "TSTypeParameterDeclaration", + params: Array [ + TSTypeParameter { + type: "TSTypeParameter", + in: false, + name: Identifier { + type: "Identifier", + name: "T", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + out: false, + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + TSTypeParameter { + type: "TSTypeParameter", + in: false, + name: Identifier { + type: "Identifier", + name: "U", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + out: false, + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + TSTypeParameter { + type: "TSTypeParameter", + in: false, + name: Identifier { + type: "Identifier", + name: "V", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + out: false, + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + + range: [12, 21], + loc: { + start: { column: 12, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..99504b183408 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,136 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration type-param-many TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "function", + + range: [0, 8], + loc: { + start: { column: 0, 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: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "U", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "V", + + 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: [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: [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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..690e6d4036ba --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/3-Babel-AST.shot @@ -0,0 +1,90 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration type-param-many Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + FunctionDeclaration { + type: "FunctionDeclaration", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: Array [], + + range: [24, 26], + loc: { + start: { column: 24, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [], + typeParameters: TSTypeParameterDeclaration { + type: "TSTypeParameterDeclaration", + params: Array [ + TSTypeParameter { + type: "TSTypeParameter", + name: "T", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + TSTypeParameter { + type: "TSTypeParameter", + name: "U", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + TSTypeParameter { + type: "TSTypeParameter", + name: "V", + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + + range: [12, 21], + loc: { + start: { column: 12, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..b7e57a6f4045 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,136 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration type-param-many Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "function", + + range: [0, 8], + loc: { + start: { column: 0, 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: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "U", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "V", + + 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: [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: [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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..98ace90820fb --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,130 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration type-param-many AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [24, 26], + loc: { + start: { column: 24, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', + name: 'foo', + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [], + typeParameters: TSTypeParameterDeclaration { + type: 'TSTypeParameterDeclaration', + params: Array [ + TSTypeParameter { + type: 'TSTypeParameter', +- in: false, +- name: Identifier { +- type: 'Identifier', +- name: 'T', +- +- range: [13, 14], +- loc: { +- start: { column: 13, line: 1 }, +- end: { column: 14, line: 1 }, +- }, +- }, +- out: false, ++ name: 'T', + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + TSTypeParameter { + type: 'TSTypeParameter', +- in: false, +- name: Identifier { +- type: 'Identifier', +- name: 'U', +- +- range: [16, 17], +- loc: { +- start: { column: 16, line: 1 }, +- end: { column: 17, line: 1 }, +- }, +- }, +- out: false, ++ name: 'U', + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + TSTypeParameter { + type: 'TSTypeParameter', +- in: false, +- name: Identifier { +- type: 'Identifier', +- name: 'V', +- +- range: [19, 20], +- loc: { +- start: { column: 19, line: 1 }, +- end: { column: 20, line: 1 }, +- }, +- }, +- out: false, ++ name: 'V', + + range: [19, 20], + loc: { + start: { column: 19, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + + range: [12, 21], + loc: { + start: { column: 12, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..af00d0fb8523 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-many/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration type-param-many AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/fixture.ts b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/fixture.ts new file mode 100644 index 000000000000..7994e752aa81 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/fixture.ts @@ -0,0 +1 @@ +function foo() {} diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..b2caab0f05b8 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,81 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration type-param-one TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + FunctionDeclaration { + type: "FunctionDeclaration", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: Array [], + + range: [18, 20], + loc: { + start: { column: 18, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [], + typeParameters: TSTypeParameterDeclaration { + type: "TSTypeParameterDeclaration", + params: Array [ + TSTypeParameter { + type: "TSTypeParameter", + in: false, + name: Identifier { + type: "Identifier", + name: "T", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + out: false, + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + + 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/FunctionDeclaration/fixtures/type-param-one/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..9227520d1535 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration type-param-one TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "function", + + range: [0, 8], + loc: { + start: { column: 0, 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: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + 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 }, + }, + }, + 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, 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/FunctionDeclaration/fixtures/type-param-one/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..5083d4d25cb2 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/3-Babel-AST.shot @@ -0,0 +1,70 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration type-param-one Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + FunctionDeclaration { + type: "FunctionDeclaration", + async: false, + body: BlockStatement { + type: "BlockStatement", + body: Array [], + + range: [18, 20], + loc: { + start: { column: 18, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [], + typeParameters: TSTypeParameterDeclaration { + type: "TSTypeParameterDeclaration", + params: Array [ + TSTypeParameter { + type: "TSTypeParameter", + name: "T", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + + 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/FunctionDeclaration/fixtures/type-param-one/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..72cd1481fd3f --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration type-param-one Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "function", + + range: [0, 8], + loc: { + start: { column: 0, 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: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + 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 }, + }, + }, + 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, 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/FunctionDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..b997a40aca31 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration type-param-one AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + FunctionDeclaration { + type: 'FunctionDeclaration', + async: false, + body: BlockStatement { + type: 'BlockStatement', + body: Array [], + + range: [18, 20], + loc: { + start: { column: 18, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', + name: 'foo', + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [], + typeParameters: TSTypeParameterDeclaration { + type: 'TSTypeParameterDeclaration', + params: Array [ + TSTypeParameter { + type: 'TSTypeParameter', +- in: false, +- name: Identifier { +- type: 'Identifier', +- name: 'T', +- +- range: [13, 14], +- loc: { +- start: { column: 13, line: 1 }, +- end: { column: 14, line: 1 }, +- }, +- }, +- out: false, ++ name: 'T', + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + + range: [12, 15], + loc: { + start: { column: 12, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + + 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/FunctionDeclaration/fixtures/type-param-one/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..bf84a177ecc8 --- /dev/null +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/fixtures/type-param-one/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration FunctionDeclaration type-param-one AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/FunctionDeclaration/spec.ts b/packages/ast-spec/src/declaration/FunctionDeclaration/spec.ts index 59d7c4ffe39d..4fe3d2dc693e 100644 --- a/packages/ast-spec/src/declaration/FunctionDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/FunctionDeclaration/spec.ts @@ -1,8 +1,25 @@ import type { AST_NODE_TYPES } from '../../ast-node-types'; -import type { FunctionDeclarationBase } from '../../base/FunctionDeclarationBase'; +import type { FunctionBase } from '../../base/FunctionBase'; +import type { Identifier } from '../../expression/Identifier/spec'; import type { BlockStatement } from '../../statement/BlockStatement/spec'; -export interface FunctionDeclaration extends FunctionDeclarationBase { +interface FunctionDeclarationBase extends FunctionBase { type: AST_NODE_TYPES.FunctionDeclaration; body: BlockStatement; + // TODO(#5020) - make this always `false` if it is not `declare`d instead of `undefined` + declare?: false; + expression: false; } + +export interface FunctionDeclarationWithName extends FunctionDeclarationBase { + id: Identifier; +} + +export interface FunctionDeclarationWithOptionalName + extends FunctionDeclarationBase { + id: Identifier | null; +} + +export type FunctionDeclaration = + | FunctionDeclarationWithName + | FunctionDeclarationWithOptionalName; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-non-identifier/fixture.ts b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-non-identifier/fixture.ts new file mode 100644 index 000000000000..965d8a696533 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-non-identifier/fixture.ts @@ -0,0 +1 @@ +import 1 from 'mod'; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-non-identifier/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-non-identifier/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..233c225dd505 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-non-identifier/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration _error_ default-non-identifier TSESTree - Error 1`] = `[TSError: Declaration or statement expected.]`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-non-identifier/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-non-identifier/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..438c9cdf7501 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-non-identifier/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration _error_ default-non-identifier Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:7)]`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-non-identifier/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-non-identifier/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..2e0bcbec5a5e --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/default-non-identifier/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration _error_ default-non-identifier Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/fixture.ts b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/fixture.ts new file mode 100644 index 000000000000..f3cb6e658e22 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/fixture.ts @@ -0,0 +1 @@ +import { b }, * as a from 'a'; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..d94d399517ff --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration _error_ named-and-namespace TSESTree - Error 1`] = `[TSError: 'from' expected.]`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..9cf4c4b719a9 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration _error_ named-and-namespace Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "from" (1:12)]`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..89fae3fa27c3 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-and-namespace/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration _error_ named-and-namespace Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-non-identifier/fixture.ts b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-non-identifier/fixture.ts new file mode 100644 index 000000000000..6a7fb92600de --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-non-identifier/fixture.ts @@ -0,0 +1 @@ +import { 1 } from 'mod'; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-non-identifier/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-non-identifier/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..2ca1651099be --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/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 ImportDeclaration _error_ named-non-identifier TSESTree - Error 1`] = `[TSError: Identifier expected.]`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-non-identifier/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-non-identifier/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..970528e3253d --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/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 ImportDeclaration _error_ named-non-identifier Babel - Error 1`] = `[SyntaxError: Unexpected token (1:9)]`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-non-identifier/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/named-non-identifier/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..fefbeef9c524 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/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 ImportDeclaration _error_ named-non-identifier Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/fixture.ts b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/fixture.ts new file mode 100644 index 000000000000..9f7ee22b7ddf --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/fixture.ts @@ -0,0 +1 @@ +import * as b, a from 'mod'; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..9d2be22fe16f --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-and-default TSESTree - Error 1`] = `[TSError: 'from' expected.]`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..294d069aacc6 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-and-default Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "from" (1:13)]`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..6e491db0e63b --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-default/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-and-default Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/fixture.ts b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/fixture.ts new file mode 100644 index 000000000000..52bcac2fdbf7 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/fixture.ts @@ -0,0 +1 @@ +import * as a, { b } from 'a'; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..a2271606e4be --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-and-named TSESTree - Error 1`] = `[TSError: 'from' expected.]`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..605940a84336 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-and-named Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "from" (1:13)]`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..f1e891dbecaf --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-named/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-and-named Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/fixture.ts b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/fixture.ts new file mode 100644 index 000000000000..6d678fc59835 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/fixture.ts @@ -0,0 +1 @@ +import * as a, * as b from 'a'; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..0a5d4ab3922f --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-and-namespace TSESTree - Error 1`] = `[TSError: 'from' expected.]`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..8efbfcaf5191 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-and-namespace Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "from" (1:13)]`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..e3c8c7a6288d --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-and-namespace/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-and-namespace Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/fixture.ts b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/fixture.ts new file mode 100644 index 000000000000..539e09df8d0e --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/fixture.ts @@ -0,0 +1 @@ +import * as 1 from 'mod'; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..fa9ec459a928 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-non-identifier TSESTree - Error 1`] = `[TSError: Identifier expected.]`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..a511cc6c94d3 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-non-identifier Babel - Error 1`] = `[SyntaxError: Unexpected token (1:12)]`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..f0d97ae32bc8 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/namespace-non-identifier/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration _error_ namespace-non-identifier Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/non-string-source/fixture.ts b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/non-string-source/fixture.ts new file mode 100644 index 000000000000..a4a63604c811 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/non-string-source/fixture.ts @@ -0,0 +1 @@ +import * as x from module; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/non-string-source/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/non-string-source/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..4cfff84fd98c --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/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 ImportDeclaration _error_ non-string-source TSESTree - Error 1`] = `[TSError: Module specifier must be a string literal.]`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/non-string-source/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/non-string-source/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..49abb8366621 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/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 ImportDeclaration _error_ non-string-source Babel - Error 1`] = `[SyntaxError: Unexpected token (1:19)]`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/non-string-source/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/_error_/non-string-source/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..0d5964ffc24c --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/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 ImportDeclaration _error_ non-string-source Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/fixture.ts b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/fixture.ts new file mode 100644 index 000000000000..3bd366a8d054 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/fixture.ts @@ -0,0 +1 @@ +import * as a from 'mod' assert { type: 'json' }; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..877884e2c9ad --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,90 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration assertion TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ImportDeclaration { + type: "ImportDeclaration", + assertions: Array [ + ImportAttribute { + type: "ImportAttribute", + key: Identifier { + type: "Identifier", + name: "type", + + range: [34, 38], + loc: { + start: { column: 34, line: 1 }, + end: { column: 38, line: 1 }, + }, + }, + value: Literal { + type: "Literal", + raw: "'json'", + value: "json", + + range: [40, 46], + loc: { + start: { column: 40, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + + range: [34, 46], + loc: { + start: { column: 34, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + ], + importKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [19, 24], + loc: { + start: { column: 19, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + specifiers: Array [ + ImportNamespaceSpecifier { + type: "ImportNamespaceSpecifier", + local: Identifier { + type: "Identifier", + name: "a", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [7, 13], + loc: { + start: { column: 7, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + + range: [0, 49], + loc: { + start: { column: 0, line: 1 }, + end: { column: 49, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 50], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..3b0706c7d31f --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,136 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration assertion TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + 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: "a", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [14, 18], + loc: { + start: { column: 14, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [19, 24], + loc: { + start: { column: 19, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "assert", + + range: [25, 31], + loc: { + start: { column: 25, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [32, 33], + loc: { + start: { column: 32, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "type", + + range: [34, 38], + loc: { + start: { column: 34, line: 1 }, + end: { column: 38, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [38, 39], + loc: { + start: { column: 38, line: 1 }, + end: { column: 39, line: 1 }, + }, + }, + String { + type: "String", + value: "'json'", + + range: [40, 46], + loc: { + start: { column: 40, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [47, 48], + loc: { + start: { column: 47, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [48, 49], + loc: { + start: { column: 48, line: 1 }, + end: { column: 49, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..54c2381228b0 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/3-Babel-AST.shot @@ -0,0 +1,90 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration assertion Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ImportDeclaration { + type: "ImportDeclaration", + assertions: Array [ + ImportAttribute { + type: "ImportAttribute", + key: Identifier { + type: "Identifier", + name: "type", + + range: [34, 38], + loc: { + start: { column: 34, line: 1 }, + end: { column: 38, line: 1 }, + }, + }, + value: Literal { + type: "Literal", + raw: "'json'", + value: "json", + + range: [40, 46], + loc: { + start: { column: 40, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + + range: [34, 46], + loc: { + start: { column: 34, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + ], + importKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [19, 24], + loc: { + start: { column: 19, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + specifiers: Array [ + ImportNamespaceSpecifier { + type: "ImportNamespaceSpecifier", + local: Identifier { + type: "Identifier", + name: "a", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [7, 13], + loc: { + start: { column: 7, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + + range: [0, 49], + loc: { + start: { column: 0, line: 1 }, + end: { column: 49, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 50], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..30c2bd49245d --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,136 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration assertion Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + 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: "a", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [14, 18], + loc: { + start: { column: 14, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [19, 24], + loc: { + start: { column: 19, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "assert", + + range: [25, 31], + loc: { + start: { column: 25, line: 1 }, + end: { column: 31, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [32, 33], + loc: { + start: { column: 32, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "type", + + range: [34, 38], + loc: { + start: { column: 34, line: 1 }, + end: { column: 38, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [38, 39], + loc: { + start: { column: 38, line: 1 }, + end: { column: 39, line: 1 }, + }, + }, + String { + type: "String", + value: "'json'", + + range: [40, 46], + loc: { + start: { column: 40, line: 1 }, + end: { column: 46, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [47, 48], + loc: { + start: { column: 47, line: 1 }, + end: { column: 48, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [48, 49], + loc: { + start: { column: 48, line: 1 }, + end: { column: 49, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..c7b85e439dad --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration assertion AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..3189b2704ef9 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/assertion/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration assertion AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/fixture.ts b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/fixture.ts new file mode 100644 index 000000000000..ac5f18056a31 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/fixture.ts @@ -0,0 +1 @@ +import a, { b, c, d } from 'mod'; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..3b5e6f5d956a --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,149 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-named-many TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ImportDeclaration { + type: "ImportDeclaration", + assertions: Array [], + importKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [27, 32], + loc: { + start: { column: 27, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: "ImportDefaultSpecifier", + local: Identifier { + type: "Identifier", + name: "a", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + ImportSpecifier { + type: "ImportSpecifier", + imported: Identifier { + type: "Identifier", + name: "b", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + importKind: "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 }, + }, + }, + ImportSpecifier { + type: "ImportSpecifier", + imported: Identifier { + type: "Identifier", + name: "c", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + importKind: "value", + local: Identifier { + type: "Identifier", + name: "c", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ImportSpecifier { + type: "ImportSpecifier", + imported: Identifier { + type: "Identifier", + name: "d", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + importKind: "value", + local: Identifier { + type: "Identifier", + name: "d", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 34], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..1d4c57f89eb5 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,136 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-named-many TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [8, 9], + loc: { + start: { column: 8, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "b", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "c", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "d", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [22, 26], + loc: { + start: { column: 22, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [27, 32], + loc: { + start: { column: 27, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [32, 33], + loc: { + start: { column: 32, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..d1207f8c6cc5 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/3-Babel-AST.shot @@ -0,0 +1,149 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-named-many Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ImportDeclaration { + type: "ImportDeclaration", + assertions: Array [], + importKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [27, 32], + loc: { + start: { column: 27, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: "ImportDefaultSpecifier", + local: Identifier { + type: "Identifier", + name: "a", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + ImportSpecifier { + type: "ImportSpecifier", + imported: Identifier { + type: "Identifier", + name: "b", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + importKind: "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 }, + }, + }, + ImportSpecifier { + type: "ImportSpecifier", + imported: Identifier { + type: "Identifier", + name: "c", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + importKind: "value", + local: Identifier { + type: "Identifier", + name: "c", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ImportSpecifier { + type: "ImportSpecifier", + imported: Identifier { + type: "Identifier", + name: "d", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + importKind: "value", + local: Identifier { + type: "Identifier", + name: "d", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + + range: [0, 33], + loc: { + start: { column: 0, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 34], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..3cfb21679c8e --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,136 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-named-many Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [8, 9], + loc: { + start: { column: 8, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "b", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "c", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "d", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [22, 26], + loc: { + start: { column: 22, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [27, 32], + loc: { + start: { column: 27, line: 1 }, + end: { column: 32, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [32, 33], + loc: { + start: { column: 32, line: 1 }, + end: { column: 33, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..5a7d0eb9f83d --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-named-many AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..00895e193743 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-many/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-named-many AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/fixture.ts b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/fixture.ts new file mode 100644 index 000000000000..d808a750ce81 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/fixture.ts @@ -0,0 +1,2 @@ +// prettier-ignore +import a, {} from 'mod'; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..0e94a0b6bb97 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,59 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-named-none TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ImportDeclaration { + type: "ImportDeclaration", + assertions: Array [], + importKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [37, 42], + loc: { + start: { column: 18, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: "ImportDefaultSpecifier", + local: Identifier { + type: "Identifier", + name: "a", + + range: [26, 27], + loc: { + start: { column: 7, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + + range: [26, 27], + loc: { + start: { column: 7, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + ], + + range: [19, 43], + loc: { + start: { column: 0, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + ], + sourceType: "module", + + range: [19, 44], + loc: { + start: { column: 0, line: 2 }, + end: { column: 0, line: 3 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..99bb6d113e54 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-named-none TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + range: [19, 25], + loc: { + start: { column: 0, line: 2 }, + end: { column: 6, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + range: [26, 27], + loc: { + start: { column: 7, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [27, 28], + loc: { + start: { column: 8, line: 2 }, + end: { column: 9, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [29, 30], + loc: { + start: { column: 10, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [30, 31], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [32, 36], + loc: { + start: { column: 13, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [37, 42], + loc: { + start: { column: 18, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [42, 43], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..ee34379e43eb --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/3-Babel-AST.shot @@ -0,0 +1,59 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-named-none Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ImportDeclaration { + type: "ImportDeclaration", + assertions: Array [], + importKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [37, 42], + loc: { + start: { column: 18, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: "ImportDefaultSpecifier", + local: Identifier { + type: "Identifier", + name: "a", + + range: [26, 27], + loc: { + start: { column: 7, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + + range: [26, 27], + loc: { + start: { column: 7, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + ], + + range: [19, 43], + loc: { + start: { column: 0, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, + ], + sourceType: "module", + + range: [19, 44], + loc: { + start: { column: 0, line: 2 }, + end: { column: 0, line: 3 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..56ab10c4f1c8 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-named-none Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + range: [19, 25], + loc: { + start: { column: 0, line: 2 }, + end: { column: 6, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + range: [26, 27], + loc: { + start: { column: 7, line: 2 }, + end: { column: 8, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [27, 28], + loc: { + start: { column: 8, line: 2 }, + end: { column: 9, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [29, 30], + loc: { + start: { column: 10, line: 2 }, + end: { column: 11, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [30, 31], + loc: { + start: { column: 11, line: 2 }, + end: { column: 12, line: 2 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [32, 36], + loc: { + start: { column: 13, line: 2 }, + end: { column: 17, line: 2 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [37, 42], + loc: { + start: { column: 18, line: 2 }, + end: { column: 23, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [42, 43], + loc: { + start: { column: 23, line: 2 }, + end: { column: 24, line: 2 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..77b9d9ec72bc --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-named-none AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..db5dec353c24 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-none/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-named-none AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/fixture.ts b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/fixture.ts new file mode 100644 index 000000000000..5e938031ed6f --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/fixture.ts @@ -0,0 +1 @@ +import a, { b } from 'mod'; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..362d429e0274 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,89 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-named-one TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ImportDeclaration { + type: "ImportDeclaration", + assertions: Array [], + importKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [21, 26], + loc: { + start: { column: 21, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: "ImportDefaultSpecifier", + local: Identifier { + type: "Identifier", + name: "a", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + ImportSpecifier { + type: "ImportSpecifier", + imported: Identifier { + type: "Identifier", + name: "b", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + importKind: "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, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..99806f28e2f1 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-named-one TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [8, 9], + loc: { + start: { column: 8, 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 }, + }, + }, + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [21, 26], + loc: { + start: { column: 21, 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/ImportDeclaration/fixtures/default-and-named-one/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..45b6d3ec61ed --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/3-Babel-AST.shot @@ -0,0 +1,89 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-named-one Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ImportDeclaration { + type: "ImportDeclaration", + assertions: Array [], + importKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [21, 26], + loc: { + start: { column: 21, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: "ImportDefaultSpecifier", + local: Identifier { + type: "Identifier", + name: "a", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + ImportSpecifier { + type: "ImportSpecifier", + imported: Identifier { + type: "Identifier", + name: "b", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + importKind: "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, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..e11fa0be693a --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-named-one Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [8, 9], + loc: { + start: { column: 8, 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 }, + }, + }, + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [21, 26], + loc: { + start: { column: 21, 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/ImportDeclaration/fixtures/default-and-named-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..8661b6d43b20 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-named-one AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..8f0c817495a3 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-named-one/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-named-one AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/fixture.ts b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/fixture.ts new file mode 100644 index 000000000000..e18354616a73 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/fixture.ts @@ -0,0 +1 @@ +import a, * as b from 'mod'; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..88c4eac8c154 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,78 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-namespace TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ImportDeclaration { + type: "ImportDeclaration", + assertions: Array [], + importKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [22, 27], + loc: { + start: { column: 22, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: "ImportDefaultSpecifier", + local: Identifier { + type: "Identifier", + name: "a", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + ImportNamespaceSpecifier { + type: "ImportNamespaceSpecifier", + local: Identifier { + type: "Identifier", + name: "b", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [10, 16], + loc: { + start: { column: 10, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..f78a2e961787 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-namespace TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [8, 9], + loc: { + start: { column: 8, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "as", + + range: [12, 14], + loc: { + start: { column: 12, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "b", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [17, 21], + loc: { + start: { column: 17, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [22, 27], + loc: { + start: { column: 22, 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/ImportDeclaration/fixtures/default-and-namespace/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..25d8c6db0a39 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/3-Babel-AST.shot @@ -0,0 +1,78 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-namespace Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ImportDeclaration { + type: "ImportDeclaration", + assertions: Array [], + importKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [22, 27], + loc: { + start: { column: 22, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: "ImportDefaultSpecifier", + local: Identifier { + type: "Identifier", + name: "a", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + ImportNamespaceSpecifier { + type: "ImportNamespaceSpecifier", + local: Identifier { + type: "Identifier", + name: "b", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [10, 16], + loc: { + start: { column: 10, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + + range: [0, 28], + loc: { + start: { column: 0, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..b6bc0f06e1d4 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-namespace Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [8, 9], + loc: { + start: { column: 8, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "as", + + range: [12, 14], + loc: { + start: { column: 12, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "b", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [17, 21], + loc: { + start: { column: 17, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [22, 27], + loc: { + start: { column: 22, 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/ImportDeclaration/fixtures/default-and-namespace/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..c975ae691183 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-namespace AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..2ea3772b5fc8 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default-and-namespace/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default-and-namespace AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/fixture.ts b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/fixture.ts new file mode 100644 index 000000000000..b4fa44ea4352 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/fixture.ts @@ -0,0 +1 @@ +import a from 'mod'; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..8575ecc99e21 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,59 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ImportDeclaration { + type: "ImportDeclaration", + assertions: Array [], + importKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [14, 19], + loc: { + start: { column: 14, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: "ImportDefaultSpecifier", + local: Identifier { + type: "Identifier", + name: "a", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + ], + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..b2ac2cf753d1 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + 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 }, + }, + }, + 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/ImportDeclaration/fixtures/default/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..bfb44b15fa6e --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/3-Babel-AST.shot @@ -0,0 +1,59 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ImportDeclaration { + type: "ImportDeclaration", + assertions: Array [], + importKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [14, 19], + loc: { + start: { column: 14, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + specifiers: Array [ + ImportDefaultSpecifier { + type: "ImportDefaultSpecifier", + local: Identifier { + type: "Identifier", + name: "a", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + ], + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..e5c09dd423ed --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + 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 }, + }, + }, + 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/ImportDeclaration/fixtures/default/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..2524045a8077 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..75669766d635 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/default/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration default AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/fixture.ts b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/fixture.ts new file mode 100644 index 000000000000..4c8852af5629 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/fixture.ts @@ -0,0 +1 @@ +import { a, b, c } from 'mod'; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..a90f8ca955ae --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,130 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration named-many TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ImportDeclaration { + type: "ImportDeclaration", + assertions: Array [], + importKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [24, 29], + loc: { + start: { column: 24, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + specifiers: Array [ + ImportSpecifier { + type: "ImportSpecifier", + imported: Identifier { + type: "Identifier", + name: "a", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + importKind: "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 }, + }, + }, + ImportSpecifier { + type: "ImportSpecifier", + imported: Identifier { + type: "Identifier", + name: "b", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + importKind: "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 }, + }, + }, + ImportSpecifier { + type: "ImportSpecifier", + imported: Identifier { + type: "Identifier", + name: "c", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + importKind: "value", + local: Identifier { + type: "Identifier", + name: "c", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..8eba9974a714 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration named-many TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + 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: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "c", + + range: [15, 16], + loc: { + start: { column: 15, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [19, 23], + loc: { + start: { column: 19, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [24, 29], + loc: { + start: { column: 24, 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/ImportDeclaration/fixtures/named-many/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..89d89d705a6f --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/3-Babel-AST.shot @@ -0,0 +1,130 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration named-many Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ImportDeclaration { + type: "ImportDeclaration", + assertions: Array [], + importKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [24, 29], + loc: { + start: { column: 24, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + specifiers: Array [ + ImportSpecifier { + type: "ImportSpecifier", + imported: Identifier { + type: "Identifier", + name: "a", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + importKind: "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 }, + }, + }, + ImportSpecifier { + type: "ImportSpecifier", + imported: Identifier { + type: "Identifier", + name: "b", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + importKind: "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 }, + }, + }, + ImportSpecifier { + type: "ImportSpecifier", + imported: Identifier { + type: "Identifier", + name: "c", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + importKind: "value", + local: Identifier { + type: "Identifier", + name: "c", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + ], + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..123471f1513f --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration named-many Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + 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: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "c", + + range: [15, 16], + loc: { + start: { column: 15, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [19, 23], + loc: { + start: { column: 19, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [24, 29], + loc: { + start: { column: 24, 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/ImportDeclaration/fixtures/named-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..3f4b4b678e7d --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration named-many AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..254949c9452f --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-many/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration named-many AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-none/fixture.ts b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-none/fixture.ts new file mode 100644 index 000000000000..421d8a81af3f --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-none/fixture.ts @@ -0,0 +1 @@ +import {} from 'mod'; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-none/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-none/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..12f54a5140e9 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-none/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,39 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration named-none TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ImportDeclaration { + type: "ImportDeclaration", + assertions: Array [], + importKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [15, 20], + loc: { + start: { column: 15, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + specifiers: Array [], + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-none/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-none/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..04c72987e07c --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-none/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration named-none TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + 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 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [10, 14], + loc: { + start: { column: 10, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [15, 20], + loc: { + start: { column: 15, 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/ImportDeclaration/fixtures/named-none/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-none/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..cf425c46b79a --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-none/snapshots/3-Babel-AST.shot @@ -0,0 +1,39 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration named-none Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ImportDeclaration { + type: "ImportDeclaration", + assertions: Array [], + importKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [15, 20], + loc: { + start: { column: 15, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + specifiers: Array [], + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + sourceType: "module", + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-none/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-none/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..ec45fb03592b --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-none/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration named-none Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + 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 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [10, 14], + loc: { + start: { column: 10, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [15, 20], + loc: { + start: { column: 15, 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/ImportDeclaration/fixtures/named-none/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-none/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..aa52a0d98d1c --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-none/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration named-none AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-none/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-none/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..4f0ab4858e6c --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-none/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration named-none AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/fixture.ts b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/fixture.ts new file mode 100644 index 000000000000..7f1f6a4aa225 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/fixture.ts @@ -0,0 +1 @@ +import { a } from 'mod'; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..9030519529e6 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,70 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration named-one TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ImportDeclaration { + type: "ImportDeclaration", + assertions: Array [], + importKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [18, 23], + loc: { + start: { column: 18, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + specifiers: Array [ + ImportSpecifier { + type: "ImportSpecifier", + imported: Identifier { + type: "Identifier", + name: "a", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + importKind: "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, 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/ImportDeclaration/fixtures/named-one/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..b437ec118b9a --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration named-one TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [13, 17], + loc: { + start: { column: 13, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [18, 23], + loc: { + start: { column: 18, 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/ImportDeclaration/fixtures/named-one/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..6bc6fe7a38b5 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/3-Babel-AST.shot @@ -0,0 +1,70 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration named-one Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ImportDeclaration { + type: "ImportDeclaration", + assertions: Array [], + importKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [18, 23], + loc: { + start: { column: 18, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + specifiers: Array [ + ImportSpecifier { + type: "ImportSpecifier", + imported: Identifier { + type: "Identifier", + name: "a", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + importKind: "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, 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/ImportDeclaration/fixtures/named-one/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..fddf4bb21efb --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration named-one Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "from", + + range: [13, 17], + loc: { + start: { column: 13, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [18, 23], + loc: { + start: { column: 18, 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/ImportDeclaration/fixtures/named-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..a502907e8f62 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration named-one AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..f1aacd2d411c --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/named-one/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration named-one AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/side-effect/fixture.ts b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/side-effect/fixture.ts new file mode 100644 index 000000000000..381cd70b72f1 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/side-effect/fixture.ts @@ -0,0 +1 @@ +import 'mod'; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/side-effect/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/side-effect/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..62da72509bd0 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/side-effect/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,39 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration side-effect TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ImportDeclaration { + type: "ImportDeclaration", + assertions: Array [], + importKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [7, 12], + loc: { + start: { column: 7, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + specifiers: Array [], + + 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/ImportDeclaration/fixtures/side-effect/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/side-effect/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..dd471c34db4b --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/side-effect/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration side-effect TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [7, 12], + loc: { + start: { column: 7, 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/ImportDeclaration/fixtures/side-effect/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/side-effect/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..ab134ebecf8e --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/side-effect/snapshots/3-Babel-AST.shot @@ -0,0 +1,39 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration side-effect Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + ImportDeclaration { + type: "ImportDeclaration", + assertions: Array [], + importKind: "value", + source: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [7, 12], + loc: { + start: { column: 7, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + specifiers: Array [], + + 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/ImportDeclaration/fixtures/side-effect/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/side-effect/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..d8e354e5b035 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/side-effect/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration side-effect Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [7, 12], + loc: { + start: { column: 7, 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/ImportDeclaration/fixtures/side-effect/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/side-effect/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..2fa96b2dc1ca --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/side-effect/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration side-effect AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/side-effect/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/side-effect/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..1d074a399032 --- /dev/null +++ b/packages/ast-spec/src/declaration/ImportDeclaration/fixtures/side-effect/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration ImportDeclaration side-effect AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/ImportDeclaration/spec.ts b/packages/ast-spec/src/declaration/ImportDeclaration/spec.ts index b9689fe2c098..389af77f87a1 100644 --- a/packages/ast-spec/src/declaration/ImportDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/ImportDeclaration/spec.ts @@ -7,8 +7,31 @@ import type { ImportKind } from '../ExportAndImportKind'; export interface ImportDeclaration extends BaseNode { type: AST_NODE_TYPES.ImportDeclaration; + /** + * The assertions declared for the export. + * ``` + * import * from 'mod' assert { type: 'json' }; + * ``` + */ + assertions: ImportAttribute[]; + /** + * The kind of the import. + */ + importKind: ImportKind; + /** + * The source module being imported from. + */ source: StringLiteral; + /** + * The specifiers being imported. + * If this is an empty array then either there are no specifiers: + * ``` + * import {} from 'mod'; + * ``` + * Or it is a side-effect import: + * ``` + * import 'mod'; + * ``` + */ specifiers: ImportClause[]; - importKind: ImportKind; - assertions: ImportAttribute[]; } diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/fixture.ts b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/fixture.ts new file mode 100644 index 000000000000..204adf1135a6 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/fixture.ts @@ -0,0 +1 @@ +declare async function foo(); diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..d01382249a1a --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,40 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction async TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSDeclareFunction { + type: "TSDeclareFunction", + async: true, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [23, 26], + loc: { + start: { column: 23, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + params: Array [], + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..79f1c74928b4 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction _error_ async TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..01db37879fb0 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction _error_ async Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:7)]`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..57b56f38b089 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction async TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "async", + + range: [8, 13], + loc: { + start: { column: 8, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "function", + + range: [14, 22], + loc: { + start: { column: 14, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + range: [23, 26], + loc: { + start: { column: 23, 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: [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/TSDeclareFunction/fixtures/_error_/async/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..1f36cb0955fb --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/async/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction _error_ async Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/declare-with-body/fixture.ts b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/declare-with-body/fixture.ts new file mode 100644 index 000000000000..d99be022e46e --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/declare-with-body/fixture.ts @@ -0,0 +1 @@ +declare function foo(): void {}; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/declare-with-body/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/declare-with-body/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..ca0dba2a0c34 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/declare-with-body/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction _error_ declare-with-body TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/declare-with-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/declare-with-body/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..e56bbb598920 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/declare-with-body/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction _error_ declare-with-body Babel - Error 1`] = `[SyntaxError: An implementation cannot be declared in ambient contexts. (1:0)]`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/declare-with-body/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/declare-with-body/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..22b125b56439 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/declare-with-body/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction _error_ declare-with-body Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/fixture.ts b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/fixture.ts new file mode 100644 index 000000000000..9b557f21605c --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/fixture.ts @@ -0,0 +1 @@ +declare function (); diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..53a142d37bec --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction _error_ missing-id-and-not-exported TSESTree - Error 1`] = `[TSError: Identifier expected.]`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..bb9716addfbd --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction _error_ missing-id-and-not-exported Babel - Error 1`] = `[SyntaxError: Unexpected token (1:17)]`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..7bd554c552ac --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-id-and-not-exported/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction _error_ missing-id-and-not-exported Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/fixture.ts b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/fixture.ts new file mode 100644 index 000000000000..a209e2670b2f --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/fixture.ts @@ -0,0 +1 @@ +declare function foo<>(): void; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..217a78df58b6 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction _error_ missing-type-param TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..be819649c559 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction _error_ missing-type-param Babel - Error 1`] = `[SyntaxError: Type parameter list cannot be empty. (1:20)]`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..83fabb4dfc72 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction _error_ missing-type-param Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-name/fixture.ts b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-name/fixture.ts new file mode 100644 index 000000000000..15adf45390c7 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-name/fixture.ts @@ -0,0 +1 @@ +declare function 1(); diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..86f0f5e5e10e --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/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 TSDeclareFunction _error_ non-identifier-name TSESTree - Error 1`] = `[TSError: Identifier expected.]`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..12fadb8985a9 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/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 TSDeclareFunction _error_ non-identifier-name Babel - Error 1`] = `[SyntaxError: Unexpected token (1:17)]`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-name/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-name/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..0587657ad4e3 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/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 TSDeclareFunction _error_ non-identifier-name Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/fixture.ts b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/fixture.ts new file mode 100644 index 000000000000..0143e128d1fe --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/fixture.ts @@ -0,0 +1 @@ +declare function f<1>(): void; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..4b033027f130 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction _error_ non-identifier-type-param TSESTree - Error 1`] = `[TSError: Type parameter declaration expected.]`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..82c36588558a --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction _error_ non-identifier-type-param Babel - Error 1`] = `[SyntaxError: Unexpected token (1:19)]`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..0d57d7e26a4f --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/_error_/non-identifier-type-param/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction _error_ non-identifier-type-param Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/fixture.ts b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/fixture.ts new file mode 100644 index 000000000000..a55ca703c8e9 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/fixture.ts @@ -0,0 +1 @@ +declare function foo(); diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..59ea1f2fa4cc --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,40 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction empty TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSDeclareFunction { + type: "TSDeclareFunction", + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [], + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..68ee13556c41 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction empty 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: "function", + + range: [8, 16], + loc: { + start: { column: 8, 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: [20, 21], + loc: { + start: { column: 20, 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 }, + }, + }, + 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/TSDeclareFunction/fixtures/empty/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..43be5f098ab0 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/3-Babel-AST.shot @@ -0,0 +1,40 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction empty Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSDeclareFunction { + type: "TSDeclareFunction", + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [], + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..ec3fc4b9093e --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction empty 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: "function", + + range: [8, 16], + loc: { + start: { column: 8, 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: [20, 21], + loc: { + start: { column: 20, 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 }, + }, + }, + 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/TSDeclareFunction/fixtures/empty/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..89f8ab5e3471 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction empty AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..e5a96e857c6e --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/empty/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction empty AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/fixture.ts b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/fixture.ts new file mode 100644 index 000000000000..55243eab2f56 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/fixture.ts @@ -0,0 +1 @@ +declare function* foo(); diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..ed8b53057929 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,40 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction generator TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSDeclareFunction { + type: "TSDeclareFunction", + async: false, + declare: true, + expression: false, + generator: true, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + params: Array [], + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..a01528659408 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction generator 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: "function", + + range: [8, 16], + loc: { + start: { column: 8, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + 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 }, + }, + }, + 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/TSDeclareFunction/fixtures/generator/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..3da973bf9f5f --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/3-Babel-AST.shot @@ -0,0 +1,40 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction generator Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSDeclareFunction { + type: "TSDeclareFunction", + async: false, + declare: true, + expression: false, + generator: true, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [18, 21], + loc: { + start: { column: 18, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + params: Array [], + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..58082427903c --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction generator 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: "function", + + range: [8, 16], + loc: { + start: { column: 8, 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "foo", + + 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 }, + }, + }, + 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/TSDeclareFunction/fixtures/generator/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..e5478271a49b --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction generator AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..0c5870a8a61e --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/generator/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction generator AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/fixture.ts b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/fixture.ts new file mode 100644 index 000000000000..3f5ccd7a7bf6 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/fixture.ts @@ -0,0 +1 @@ +declare function foo(a, b, c); diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..a7f8479f43a4 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,71 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction param-many TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSDeclareFunction { + type: "TSDeclareFunction", + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [ + Identifier { + type: "Identifier", + name: "a", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + name: "b", + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + name: "c", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..f6aa7066f1a7 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction param-many 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: "function", + + range: [8, 16], + loc: { + start: { column: 8, 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: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "b", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "c", + + 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/TSDeclareFunction/fixtures/param-many/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..d1e098a0e89d --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/3-Babel-AST.shot @@ -0,0 +1,71 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction param-many Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSDeclareFunction { + type: "TSDeclareFunction", + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [ + Identifier { + type: "Identifier", + name: "a", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + name: "b", + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + name: "c", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 31], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..c27b9fa0a5ec --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction param-many 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: "function", + + range: [8, 16], + loc: { + start: { column: 8, 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: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "b", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "c", + + 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/TSDeclareFunction/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..cfed52f085e8 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction param-many AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..d41363d11c2c --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-many/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction param-many AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/fixture.ts b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/fixture.ts new file mode 100644 index 000000000000..1e929f63edd2 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/fixture.ts @@ -0,0 +1 @@ +declare function foo(a); diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..1f21a6f71f80 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,51 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction param-one TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSDeclareFunction { + type: "TSDeclareFunction", + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [ + Identifier { + type: "Identifier", + name: "a", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..d8412c942126 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction param-one 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: "function", + + range: [8, 16], + loc: { + start: { column: 8, 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: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + 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/TSDeclareFunction/fixtures/param-one/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..abf7337612c7 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/3-Babel-AST.shot @@ -0,0 +1,51 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction param-one Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSDeclareFunction { + type: "TSDeclareFunction", + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [ + Identifier { + type: "Identifier", + name: "a", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..9dba1e7717cd --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction param-one 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: "function", + + range: [8, 16], + loc: { + start: { column: 8, 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: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + 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/TSDeclareFunction/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..81f8c45d6564 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction param-one AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..ab3a33eb7f9b --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/param-one/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction param-one AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/fixture.ts b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/fixture.ts new file mode 100644 index 000000000000..7ab5bf149376 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/fixture.ts @@ -0,0 +1 @@ +declare function foo(): void; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..45e65dbe80a1 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,58 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction returnType TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSDeclareFunction { + type: "TSDeclareFunction", + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [], + returnType: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSVoidKeyword { + type: "TSVoidKeyword", + + range: [24, 28], + loc: { + start: { column: 24, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + + range: [22, 28], + loc: { + start: { column: 22, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..f06fda6f01ee --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction returnType 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: "function", + + range: [8, 16], + loc: { + start: { column: 8, 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: [20, 21], + loc: { + start: { column: 20, 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 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "void", + + range: [24, 28], + loc: { + start: { column: 24, 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/TSDeclareFunction/fixtures/returnType/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..1ccc35aaadb4 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/3-Babel-AST.shot @@ -0,0 +1,58 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction returnType Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSDeclareFunction { + type: "TSDeclareFunction", + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [], + returnType: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSVoidKeyword { + type: "TSVoidKeyword", + + range: [24, 28], + loc: { + start: { column: 24, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + + range: [22, 28], + loc: { + start: { column: 22, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + + range: [0, 29], + loc: { + start: { column: 0, line: 1 }, + end: { column: 29, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 30], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..703e02000f58 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction returnType 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: "function", + + range: [8, 16], + loc: { + start: { column: 8, 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: [20, 21], + loc: { + start: { column: 20, 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 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ":", + + range: [22, 23], + loc: { + start: { column: 22, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "void", + + range: [24, 28], + loc: { + start: { column: 24, 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/TSDeclareFunction/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..bddda38b36f0 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction returnType AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..994903ee6092 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/returnType/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction returnType AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/fixture.ts b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/fixture.ts new file mode 100644 index 000000000000..4ab67258323e --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/fixture.ts @@ -0,0 +1 @@ +declare function foo(); diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..aefd6e905e23 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,114 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction type-param-many TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSDeclareFunction { + type: "TSDeclareFunction", + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [], + typeParameters: TSTypeParameterDeclaration { + type: "TSTypeParameterDeclaration", + params: Array [ + TSTypeParameter { + type: "TSTypeParameter", + in: false, + name: Identifier { + type: "Identifier", + name: "T", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + out: false, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + TSTypeParameter { + type: "TSTypeParameter", + in: false, + name: Identifier { + type: "Identifier", + name: "U", + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + out: false, + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + TSTypeParameter { + type: "TSTypeParameter", + in: false, + name: Identifier { + type: "Identifier", + name: "V", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + out: false, + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + + range: [20, 29], + loc: { + start: { column: 20, 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/TSDeclareFunction/fixtures/type-param-many/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..92b21a76dcf5 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,136 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction type-param-many 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: "function", + + range: [8, 16], + loc: { + start: { column: 8, 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: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "U", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "V", + + 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 }, + }, + }, + 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/TSDeclareFunction/fixtures/type-param-many/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..76dc2ebf1f56 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/3-Babel-AST.shot @@ -0,0 +1,81 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction type-param-many Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSDeclareFunction { + type: "TSDeclareFunction", + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [], + typeParameters: TSTypeParameterDeclaration { + type: "TSTypeParameterDeclaration", + params: Array [ + TSTypeParameter { + type: "TSTypeParameter", + name: "T", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + TSTypeParameter { + type: "TSTypeParameter", + name: "U", + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + TSTypeParameter { + type: "TSTypeParameter", + name: "V", + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + + range: [20, 29], + loc: { + start: { column: 20, 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/TSDeclareFunction/fixtures/type-param-many/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..6aaaa58051c6 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,136 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction type-param-many 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: "function", + + range: [8, 16], + loc: { + start: { column: 8, 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: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "U", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "V", + + 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 }, + }, + }, + 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/TSDeclareFunction/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..5c07aedab59c --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,121 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction type-param-many AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', + name: 'foo', + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [], + typeParameters: TSTypeParameterDeclaration { + type: 'TSTypeParameterDeclaration', + params: Array [ + TSTypeParameter { + type: 'TSTypeParameter', +- in: false, +- name: Identifier { +- type: 'Identifier', +- name: 'T', +- +- range: [21, 22], +- loc: { +- start: { column: 21, line: 1 }, +- end: { column: 22, line: 1 }, +- }, +- }, +- out: false, ++ name: 'T', + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + TSTypeParameter { + type: 'TSTypeParameter', +- in: false, +- name: Identifier { +- type: 'Identifier', +- name: 'U', +- +- range: [24, 25], +- loc: { +- start: { column: 24, line: 1 }, +- end: { column: 25, line: 1 }, +- }, +- }, +- out: false, ++ name: 'U', + + range: [24, 25], + loc: { + start: { column: 24, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + TSTypeParameter { + type: 'TSTypeParameter', +- in: false, +- name: Identifier { +- type: 'Identifier', +- name: 'V', +- +- range: [27, 28], +- loc: { +- start: { column: 27, line: 1 }, +- end: { column: 28, line: 1 }, +- }, +- }, +- out: false, ++ name: 'V', + + range: [27, 28], + loc: { + start: { column: 27, line: 1 }, + end: { column: 28, line: 1 }, + }, + }, + ], + + range: [20, 29], + loc: { + start: { column: 20, 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/TSDeclareFunction/fixtures/type-param-many/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..cae8ddcdbee9 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-many/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction type-param-many AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/fixture.ts b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/fixture.ts new file mode 100644 index 000000000000..3f66cd9c4604 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/fixture.ts @@ -0,0 +1 @@ +declare function foo(); diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..4767a93811ca --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,72 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction type-param-one TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSDeclareFunction { + type: "TSDeclareFunction", + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [], + typeParameters: TSTypeParameterDeclaration { + type: "TSTypeParameterDeclaration", + params: Array [ + TSTypeParameter { + type: "TSTypeParameter", + in: false, + name: Identifier { + type: "Identifier", + name: "T", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + out: false, + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + + range: [20, 23], + loc: { + start: { column: 20, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..cf3ce53768e1 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction type-param-one 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: "function", + + range: [8, 16], + loc: { + start: { column: 8, 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: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + 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 }, + }, + }, + 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..745e9cba3935 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/3-Babel-AST.shot @@ -0,0 +1,61 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction type-param-one Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSDeclareFunction { + type: "TSDeclareFunction", + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [], + typeParameters: TSTypeParameterDeclaration { + type: "TSTypeParameterDeclaration", + params: Array [ + TSTypeParameter { + type: "TSTypeParameter", + name: "T", + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + + range: [20, 23], + loc: { + start: { column: 20, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..8f4c003543d6 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction type-param-one 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: "function", + + range: [8, 16], + loc: { + start: { column: 8, 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: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + 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 }, + }, + }, + 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..6763966b08fc --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,77 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction type-param-one AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSDeclareFunction { + type: 'TSDeclareFunction', + async: false, + declare: true, + expression: false, + generator: false, + id: Identifier { + type: 'Identifier', + name: 'foo', + + range: [17, 20], + loc: { + start: { column: 17, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + params: Array [], + typeParameters: TSTypeParameterDeclaration { + type: 'TSTypeParameterDeclaration', + params: Array [ + TSTypeParameter { + type: 'TSTypeParameter', +- in: false, +- name: Identifier { +- type: 'Identifier', +- name: 'T', +- +- range: [21, 22], +- loc: { +- start: { column: 21, line: 1 }, +- end: { column: 22, line: 1 }, +- }, +- }, +- out: false, ++ name: 'T', + + range: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + + range: [20, 23], + loc: { + start: { column: 20, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..669ef13533fa --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/type-param-one/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction type-param-one AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/fixture.ts b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/fixture.ts new file mode 100644 index 000000000000..242942bf817d --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/fixture.ts @@ -0,0 +1 @@ +function foo(): void; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..5c46a6508afd --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,57 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction without-declare TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSDeclareFunction { + type: "TSDeclareFunction", + async: false, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [], + returnType: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSVoidKeyword { + type: "TSVoidKeyword", + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [14, 20], + loc: { + start: { column: 14, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..67a00cfbc1a0 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction without-declare TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "function", + + range: [0, 8], + loc: { + start: { column: 0, 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: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, 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 }, + }, + }, + Keyword { + type: "Keyword", + value: "void", + + range: [16, 20], + loc: { + start: { column: 16, 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/TSDeclareFunction/fixtures/without-declare/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..2e49a416b762 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/3-Babel-AST.shot @@ -0,0 +1,57 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction without-declare Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSDeclareFunction { + type: "TSDeclareFunction", + async: false, + expression: false, + generator: false, + id: Identifier { + type: "Identifier", + name: "foo", + + range: [9, 12], + loc: { + start: { column: 9, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + params: Array [], + returnType: TSTypeAnnotation { + type: "TSTypeAnnotation", + typeAnnotation: TSVoidKeyword { + type: "TSVoidKeyword", + + range: [16, 20], + loc: { + start: { column: 16, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [14, 20], + loc: { + start: { column: 14, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [0, 21], + loc: { + start: { column: 0, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..0c6751d92ced --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction without-declare Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "function", + + range: [0, 8], + loc: { + start: { column: 0, 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: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, 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 }, + }, + }, + Keyword { + type: "Keyword", + value: "void", + + range: [16, 20], + loc: { + start: { column: 16, 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/TSDeclareFunction/fixtures/without-declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..7f5b5b1b141d --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction without-declare AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..9995b1b0eb91 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/fixtures/without-declare/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSDeclareFunction without-declare AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSDeclareFunction/spec.ts b/packages/ast-spec/src/declaration/TSDeclareFunction/spec.ts index 88bd4aff2f21..ea37a1e874f6 100644 --- a/packages/ast-spec/src/declaration/TSDeclareFunction/spec.ts +++ b/packages/ast-spec/src/declaration/TSDeclareFunction/spec.ts @@ -1,6 +1,13 @@ import type { AST_NODE_TYPES } from '../../ast-node-types'; -import type { FunctionDeclarationBase } from '../../base/FunctionDeclarationBase'; +import type { FunctionBase } from '../../base/FunctionBase'; +import type { BlockStatement } from '../../statement/BlockStatement/spec'; -export interface TSDeclareFunction extends FunctionDeclarationBase { +// TODO(#1852) - async + declare are semantically invalid together +export interface TSDeclareFunction extends FunctionBase { type: AST_NODE_TYPES.TSDeclareFunction; + // TODO(#1852) - breaking change enforce this is always `null` like `TSEmptyBodyFunctionExpression` + body?: BlockStatement; + // TODO(#5020) - make this always `false` if it is not `declare`d instead of `undefined` + declare?: boolean; + expression: false; } diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/fixture.ts b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/fixture.ts new file mode 100644 index 000000000000..eeaa8c95655f --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/fixture.ts @@ -0,0 +1 @@ +enum Foo; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..898964994760 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration _error_ missing-body TSESTree - Error 1`] = `[TSError: '{' expected.]`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..69fc4aef1475 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration _error_ missing-body Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:8)]`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..4d1d30b58b60 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-body/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration _error_ missing-body Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/fixture.ts b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/fixture.ts new file mode 100644 index 000000000000..14404051ead9 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/fixture.ts @@ -0,0 +1 @@ +enum {} diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..0653a9025ef0 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration _error_ missing-id TSESTree - Error 1`] = `[TSError: Identifier expected.]`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..676c0503e372 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration _error_ missing-id Babel - Error 1`] = `[SyntaxError: Unexpected token (1:5)]`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..5fb97329274d --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/missing-id/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration _error_ missing-id Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/non-identifier-name/fixture.ts b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/non-identifier-name/fixture.ts new file mode 100644 index 000000000000..9089db7067dc --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/non-identifier-name/fixture.ts @@ -0,0 +1 @@ +enum 1 {} diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..15a27efccaf5 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/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 TSEnumDeclaration _error_ non-identifier-name TSESTree - Error 1`] = `[TSError: Identifier expected.]`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..1cf8f0ab8999 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/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 TSEnumDeclaration _error_ non-identifier-name Babel - Error 1`] = `[SyntaxError: Unexpected token (1:5)]`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/non-identifier-name/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/_error_/non-identifier-name/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..dd5c61750081 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/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 TSEnumDeclaration _error_ non-identifier-name Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/fixture.ts b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/fixture.ts new file mode 100644 index 000000000000..97b096b8754b --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/fixture.ts @@ -0,0 +1 @@ +const enum Foo {} diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..1d59f828b678 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,37 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration const TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSEnumDeclaration { + type: "TSEnumDeclaration", + const: true, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [11, 14], + loc: { + start: { column: 11, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + members: Array [], + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..a25cddd52f6a --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration const TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "const", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "enum", + + range: [6, 10], + loc: { + start: { column: 6, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [11, 14], + loc: { + start: { column: 11, 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..5ee7fea32e6f --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/3-Babel-AST.shot @@ -0,0 +1,37 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration const Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSEnumDeclaration { + type: "TSEnumDeclaration", + const: true, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [11, 14], + loc: { + start: { column: 11, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + members: Array [], + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..4a4ccaf3ecc8 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration const Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "const", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "enum", + + range: [6, 10], + loc: { + start: { column: 6, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [11, 14], + loc: { + start: { column: 11, 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..95d4c8f6b4a0 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration const AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..2e994fa6ae9e --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/const/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration const AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Keyword { + type: 'Keyword', + value: 'const', + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'enum', + + range: [6, 10], + loc: { + start: { column: 6, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'Foo', + + range: [11, 14], + loc: { + start: { column: 11, 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 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/fixture.ts b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/fixture.ts new file mode 100644 index 000000000000..6ec0c1cbf6a2 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/fixture.ts @@ -0,0 +1 @@ +declare enum Foo {} diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..8b742184ed94 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,37 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration declare TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSEnumDeclaration { + type: "TSEnumDeclaration", + declare: true, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [13, 16], + loc: { + start: { column: 13, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + members: Array [], + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..b045362a4c54 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration 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: "enum", + + range: [8, 12], + loc: { + start: { column: 8, 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/TSEnumDeclaration/fixtures/declare/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..21a3e86cd15c --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/3-Babel-AST.shot @@ -0,0 +1,37 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration declare Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSEnumDeclaration { + type: "TSEnumDeclaration", + declare: true, + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [13, 16], + loc: { + start: { column: 13, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + members: Array [], + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..ccf2a20885e8 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration declare Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "enum", + + range: [8, 12], + loc: { + start: { column: 8, 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/TSEnumDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..5085b6b4609b --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration declare AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..11a6693745f4 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/declare/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration declare AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Identifier { + type: 'Identifier', + value: 'declare', + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'enum', + + range: [8, 12], + loc: { + start: { column: 8, 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/TSEnumDeclaration/fixtures/empty/fixture.ts b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/fixture.ts new file mode 100644 index 000000000000..f418fb66f4f1 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/fixture.ts @@ -0,0 +1 @@ +enum Foo {} diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..85e4f093eb2f --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration empty TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSEnumDeclaration { + type: "TSEnumDeclaration", + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [5, 8], + loc: { + start: { column: 5, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + members: Array [], + + range: [0, 11], + loc: { + start: { column: 0, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..c419adb83097 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration empty TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "enum", + + range: [0, 4], + loc: { + start: { column: 0, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [5, 8], + loc: { + start: { column: 5, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..79ad82443c71 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/3-Babel-AST.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration empty Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSEnumDeclaration { + type: "TSEnumDeclaration", + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [5, 8], + loc: { + start: { column: 5, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + members: Array [], + + range: [0, 11], + loc: { + start: { column: 0, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..688f75fe0f2b --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration empty Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "enum", + + range: [0, 4], + loc: { + start: { column: 0, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [5, 8], + loc: { + start: { column: 5, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..2ce5c714db11 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration empty AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..5c9479e0ff80 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/empty/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,52 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration empty AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'enum', + + range: [0, 4], + loc: { + start: { column: 0, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'Foo', + + range: [5, 8], + loc: { + start: { column: 5, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + 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 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/fixture.ts b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/fixture.ts new file mode 100644 index 000000000000..a639ff46e1b4 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/fixture.ts @@ -0,0 +1,3 @@ +enum Foo { + A, +} diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..dc9b0027eed0 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration with-member-one TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSEnumDeclaration { + type: "TSEnumDeclaration", + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [5, 8], + loc: { + start: { column: 5, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + members: Array [ + TSEnumMember { + type: "TSEnumMember", + id: Identifier { + type: "Identifier", + name: "A", + + range: [13, 14], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + + range: [13, 14], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + ], + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..e0ddd7d58be5 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration with-member-one TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "enum", + + range: [0, 4], + loc: { + start: { column: 0, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [5, 8], + loc: { + start: { column: 5, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "A", + + range: [13, 14], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [14, 15], + loc: { + start: { column: 3, line: 2 }, + end: { column: 4, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [16, 17], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..477613196944 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/3-Babel-AST.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration with-member-one Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSEnumDeclaration { + type: "TSEnumDeclaration", + id: Identifier { + type: "Identifier", + name: "Foo", + + range: [5, 8], + loc: { + start: { column: 5, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + members: Array [ + TSEnumMember { + type: "TSEnumMember", + id: Identifier { + type: "Identifier", + name: "A", + + range: [13, 14], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + + range: [13, 14], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + ], + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..08d14feb8c4c --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration with-member-one Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "enum", + + range: [0, 4], + loc: { + start: { column: 0, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "Foo", + + range: [5, 8], + loc: { + start: { column: 5, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "A", + + range: [13, 14], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [14, 15], + loc: { + start: { column: 3, line: 2 }, + end: { column: 4, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [16, 17], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..b707fc5d46bb --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration with-member-one AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..cf146a98eac1 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/fixtures/with-member-one/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,72 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSEnumDeclaration with-member-one AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'enum', + + range: [0, 4], + loc: { + start: { column: 0, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'Foo', + + range: [5, 8], + loc: { + start: { column: 5, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'A', + + range: [13, 14], + loc: { + start: { column: 2, line: 2 }, + end: { column: 3, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ',', + + range: [14, 15], + loc: { + start: { column: 3, line: 2 }, + end: { column: 4, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [16, 17], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/TSEnumDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSEnumDeclaration/spec.ts index 1c1530d501ff..9a0df845c5d8 100644 --- a/packages/ast-spec/src/declaration/TSEnumDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/TSEnumDeclaration/spec.ts @@ -6,9 +6,30 @@ import type { Modifier } from '../../unions/Modifier'; export interface TSEnumDeclaration extends BaseNode { type: AST_NODE_TYPES.TSEnumDeclaration; - id: Identifier; - members: TSEnumMember[]; + /** + * Whether this is a `const` enum. + * ``` + * const enum Foo {...} + * ``` + */ + // TODO(#5020) - make this `false` if it is not `const` const?: boolean; + /** + * Whether this is a `declare`d enum. + * ``` + * declare enum Foo {...} + * ``` + */ + // TODO(#5020) - make this `false` if it is not `declare`d declare?: boolean; + /** + * The enum name. + */ + id: Identifier; + /** + * The enum members. + */ + members: TSEnumMember[]; + // TODO(#4759) - breaking change remove this modifiers?: Modifier[]; } diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/fixture.ts b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/fixture.ts new file mode 100644 index 000000000000..7fe439305a48 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/fixture.ts @@ -0,0 +1 @@ +import F = 1; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..3593291fdb2a --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ entity-name-invalid TSESTree - Error 1`] = `[TSError: Identifier expected.]`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..d5cc0b77735b --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ entity-name-invalid Babel - Error 1`] = `[SyntaxError: Unexpected token (1:11)]`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..463142c713f0 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/entity-name-invalid/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ entity-name-invalid Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string/fixture.ts b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string/fixture.ts new file mode 100644 index 000000000000..b67ea934e8c0 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string/fixture.ts @@ -0,0 +1 @@ +import F = require(1); diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..51aedf5fa316 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ external-module-ref-non-string TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..b19940abe312 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ external-module-ref-non-string Babel - Error 1`] = `[SyntaxError: Unexpected token (1:19)]`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..cda96c9ac3d2 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ external-module-ref-non-string Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/fixture.ts b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/fixture.ts new file mode 100644 index 000000000000..769999c5f680 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/fixture.ts @@ -0,0 +1,2 @@ +type T = 1; +import type F = T; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..387be14ced26 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ import-kind TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..b8f9e5be4e4c --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ import-kind Babel - Error 1`] = `[SyntaxError: An import alias can not use 'import type'. (2:16)]`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..d9472dcc7b67 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ import-kind Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/fixture.ts b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/fixture.ts new file mode 100644 index 000000000000..2b0ead218dd1 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/fixture.ts @@ -0,0 +1 @@ +import = A.B; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..b5dc03a804c3 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ missing-id TSESTree - Error 1`] = `[TSError: Declaration or statement expected.]`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..3c24250cf63a --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ missing-id Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:7)]`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..3f9e697fc06c --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-id/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ missing-id Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/fixture.ts b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/fixture.ts new file mode 100644 index 000000000000..3ce78a91241f --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/fixture.ts @@ -0,0 +1 @@ +import F; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..cb33fd8279bc --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ missing-reference TSESTree - Error 1`] = `[TSError: '=' expected.]`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..6dcc0a599541 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ missing-reference Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "from" (1:8)]`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..7a3b4167a3b2 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/_error_/missing-reference/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration _error_ missing-reference Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/fixture.ts b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/fixture.ts new file mode 100644 index 000000000000..fdcbe7ffe415 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/fixture.ts @@ -0,0 +1 @@ +import F = A.B.C; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..6d438a8c596e --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,85 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration entity-name-many TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSImportEqualsDeclaration { + type: "TSImportEqualsDeclaration", + id: Identifier { + type: "Identifier", + name: "F", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + importKind: "value", + isExport: false, + moduleReference: TSQualifiedName { + type: "TSQualifiedName", + left: TSQualifiedName { + type: "TSQualifiedName", + left: Identifier { + type: "Identifier", + name: "A", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + right: Identifier { + type: "Identifier", + name: "B", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + + range: [11, 14], + loc: { + start: { column: 11, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + right: Identifier { + type: "Identifier", + name: "C", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [11, 16], + loc: { + start: { column: 11, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..7d0291e8b8b2 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration entity-name-many TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "A", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "B", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "C", + + 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/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..e4d68bb9f751 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/3-Babel-AST.shot @@ -0,0 +1,85 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration entity-name-many Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSImportEqualsDeclaration { + type: "TSImportEqualsDeclaration", + id: Identifier { + type: "Identifier", + name: "F", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + importKind: "value", + isExport: false, + moduleReference: TSQualifiedName { + type: "TSQualifiedName", + left: TSQualifiedName { + type: "TSQualifiedName", + left: Identifier { + type: "Identifier", + name: "A", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + right: Identifier { + type: "Identifier", + name: "B", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + + range: [11, 14], + loc: { + start: { column: 11, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + right: Identifier { + type: "Identifier", + name: "C", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [11, 16], + loc: { + start: { column: 11, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..08ed3e892d54 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration entity-name-many Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "A", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "B", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "C", + + 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/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..88ec007b237d --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration entity-name-many AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..b006c4e07d24 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-many/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration entity-name-many AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/fixture.ts b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/fixture.ts new file mode 100644 index 000000000000..ac623ee9e280 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/fixture.ts @@ -0,0 +1 @@ +import F = A; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..aa18656723b0 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,47 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration entity-name-one TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSImportEqualsDeclaration { + type: "TSImportEqualsDeclaration", + id: Identifier { + type: "Identifier", + name: "F", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + importKind: "value", + isExport: false, + moduleReference: Identifier { + type: "Identifier", + name: "A", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, 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/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..1e7f3ae9a452 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration entity-name-one TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "A", + + 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/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..d6e2ea9ed203 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/3-Babel-AST.shot @@ -0,0 +1,47 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration entity-name-one Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSImportEqualsDeclaration { + type: "TSImportEqualsDeclaration", + id: Identifier { + type: "Identifier", + name: "F", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + importKind: "value", + isExport: false, + moduleReference: Identifier { + type: "Identifier", + name: "A", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, 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/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..85b199a73a43 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration entity-name-one Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "A", + + 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/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..0cb17969d4fb --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration entity-name-one AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..28d07eeb4739 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/entity-name-one/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration entity-name-one AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/fixture.ts b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/fixture.ts new file mode 100644 index 000000000000..2c8ef7abf25c --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/fixture.ts @@ -0,0 +1 @@ +import F = require('mod'); diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..aca9d9ab5f3c --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,57 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration external-module-ref-string TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSImportEqualsDeclaration { + type: "TSImportEqualsDeclaration", + id: Identifier { + type: "Identifier", + name: "F", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + importKind: "value", + isExport: false, + moduleReference: TSExternalModuleReference { + type: "TSExternalModuleReference", + expression: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [19, 24], + loc: { + start: { column: 19, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [11, 25], + loc: { + start: { column: 11, 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/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..023028ef7d99 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration external-module-ref-string TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "require", + + range: [11, 18], + loc: { + start: { column: 11, 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 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [19, 24], + loc: { + start: { column: 19, 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 }, + }, + }, + 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/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..f904ff1dbcff --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/3-Babel-AST.shot @@ -0,0 +1,57 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration external-module-ref-string Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSImportEqualsDeclaration { + type: "TSImportEqualsDeclaration", + id: Identifier { + type: "Identifier", + name: "F", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + importKind: "value", + isExport: false, + moduleReference: TSExternalModuleReference { + type: "TSExternalModuleReference", + expression: Literal { + type: "Literal", + raw: "'mod'", + value: "mod", + + range: [19, 24], + loc: { + start: { column: 19, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [11, 25], + loc: { + start: { column: 11, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..91b65568fbec --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration external-module-ref-string Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "import", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "require", + + range: [11, 18], + loc: { + start: { column: 11, 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 }, + }, + }, + String { + type: "String", + value: "'mod'", + + range: [19, 24], + loc: { + start: { column: 19, 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 }, + }, + }, + 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/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..a0b231ec7a17 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration external-module-ref-string AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSImportEqualsDeclaration { + type: 'TSImportEqualsDeclaration', + id: Identifier { + type: 'Identifier', + name: 'F', + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + importKind: 'value', + isExport: false, + moduleReference: TSExternalModuleReference { + type: 'TSExternalModuleReference', + expression: Literal { + type: 'Literal', + raw: '\\\\'mod\\\\'', + value: 'mod', + + range: [19, 24], + loc: { + start: { column: 19, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [11, 25], + loc: { + start: { column: 11, line: 1 }, + end: { column: 25, line: 1 }, + }, + }, + + range: [0, 26], + loc: { + start: { column: 0, line: 1 }, + end: { column: 26, line: 1 }, + }, + }, + ], +- sourceType: 'module', ++ sourceType: 'script', + + range: [0, 27], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..ce5e5680101a --- /dev/null +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSImportEqualsDeclaration external-module-ref-string AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/spec.ts index 5ccd9b6fc4fc..d4db9a64168b 100644 --- a/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/TSImportEqualsDeclaration/spec.ts @@ -7,8 +7,27 @@ import type { ImportKind } from '../ExportAndImportKind'; export interface TSImportEqualsDeclaration extends BaseNode { type: AST_NODE_TYPES.TSImportEqualsDeclaration; + /** + * The locally imported name + */ id: Identifier; + /** + * The value being aliased. + * ``` + * import F1 = A; + * import F2 = A.B.C; + * import F3 = require('mod'); + * ``` + */ moduleReference: EntityName | TSExternalModuleReference; + // TODO(#1852) - breaking change remove this as it is invalid importKind: ImportKind; + /** + * Whether this is immediately exported + * ``` + * export import F = A; + * ``` + */ + // TODO(#4130) - this should be represented in the AST isExport: boolean; } diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/fixture.ts b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/fixture.ts new file mode 100644 index 000000000000..b3123630664e --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/fixture.ts @@ -0,0 +1 @@ +interface F; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..128274dff580 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ missing-body TSESTree - Error 1`] = `[TSError: '{' expected.]`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..12baf6e07385 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ missing-body Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:11)]`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..6caba1ae72c9 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-body/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ missing-body Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/fixture.ts b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/fixture.ts new file mode 100644 index 000000000000..74fde08aea13 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/fixture.ts @@ -0,0 +1 @@ +interface F extends {} diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..a33eb58a06d4 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ missing-extends TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..add92930a37f --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ missing-extends Babel - Error 1`] = `[SyntaxError: 'extends' list cannot be empty. (1:20)]`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..6eb1bf9104f9 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ missing-extends Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/fixture.ts b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/fixture.ts new file mode 100644 index 000000000000..6b562c272fc7 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/fixture.ts @@ -0,0 +1 @@ +interface {} diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..d640ad78d536 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ missing-id TSESTree - Error 1`] = `[TSError: Interface must be given a name.]`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..e06bfcc1a1c5 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ missing-id Babel - Error 1`] = `[SyntaxError: 'interface' declarations must be followed by an identifier. (1:10)]`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..bbce8c51c4d4 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-id/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ missing-id Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/fixture.ts b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/fixture.ts new file mode 100644 index 000000000000..f03a31c78c2e --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/fixture.ts @@ -0,0 +1 @@ +interface F<> {} diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..9d0be0712d44 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ missing-type-param TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..936edbec8c8a --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ missing-type-param Babel - Error 1`] = `[SyntaxError: Type parameter list cannot be empty. (1:11)]`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..5846179dd56b --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ missing-type-param Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/fixture.ts b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/fixture.ts new file mode 100644 index 000000000000..c649bd496622 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/fixture.ts @@ -0,0 +1 @@ +interface F extends 1 {} diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..e8e8c0e5fdb9 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ non-identifier-extends TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..e7b584a9cd2e --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ non-identifier-extends Babel - Error 1`] = `[SyntaxError: Unexpected token (1:20)]`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..c429168c2884 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ non-identifier-extends Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-name/fixture.ts b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-name/fixture.ts new file mode 100644 index 000000000000..7b8c5e961eed --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-name/fixture.ts @@ -0,0 +1 @@ +interface 1 {} diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..7b6a2f0a6669 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/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 TSInterfaceDeclaration _error_ non-identifier-name TSESTree - Error 1`] = `[TSError: Interface name cannot be '1'.]`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..64f544addb3b --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/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 TSInterfaceDeclaration _error_ non-identifier-name Babel - Error 1`] = `[SyntaxError: 'interface' declarations must be followed by an identifier. (1:10)]`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-name/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-name/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..5470a1ec04e8 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/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 TSInterfaceDeclaration _error_ non-identifier-name Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/fixture.ts b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/fixture.ts new file mode 100644 index 000000000000..2809a08b8cf2 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/fixture.ts @@ -0,0 +1 @@ +interface F<1> {} diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..e48629574cff --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ non-identifier-type-param TSESTree - Error 1`] = `[TSError: Type parameter declaration expected.]`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..69166a9fa112 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ non-identifier-type-param Babel - Error 1`] = `[SyntaxError: Unexpected token (1:12)]`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..5f1be010c628 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-type-param/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration _error_ non-identifier-type-param Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/fixture.ts b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/fixture.ts new file mode 100644 index 000000000000..0e8aa5a34797 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/fixture.ts @@ -0,0 +1 @@ +declare interface F {} diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..501d609a46c6 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration declare TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: Array [], + + range: [20, 22], + loc: { + start: { column: 20, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + declare: true, + id: Identifier { + type: "Identifier", + name: "F", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..8899a66c8a3d --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration 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: "interface", + + range: [8, 17], + loc: { + start: { column: 8, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, 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: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..4642a30ee6d6 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/3-Babel-AST.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration declare Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: Array [], + + range: [20, 22], + loc: { + start: { column: 20, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + declare: true, + id: Identifier { + type: "Identifier", + name: "F", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..b75639c632d9 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration declare Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "interface", + + range: [8, 17], + loc: { + start: { column: 8, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, 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: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..c5bfaba693bb --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration declare AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..057cff335273 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/declare/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration declare AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Identifier { + type: 'Identifier', + value: 'declare', + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'interface', + + range: [8, 17], + loc: { + start: { column: 8, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'F', + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, 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: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/fixture.ts b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/fixture.ts new file mode 100644 index 000000000000..296dc32043fa --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/fixture.ts @@ -0,0 +1 @@ +interface F {} diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..aa7db3176924 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,45 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration empty TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: Array [], + + range: [12, 14], + loc: { + start: { column: 12, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..b46401c81876 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration empty TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "interface", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..e6048d6bde46 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/3-Babel-AST.shot @@ -0,0 +1,45 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration empty Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: Array [], + + range: [12, 14], + loc: { + start: { column: 12, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..01311e4df0ca --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration empty Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "interface", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..42bc3c4eb68c --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration empty AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..68a5be8dd4f8 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/empty/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,52 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration empty AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'interface', + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'F', + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/fixture.ts b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/fixture.ts new file mode 100644 index 000000000000..a0c396132b50 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/fixture.ts @@ -0,0 +1 @@ +interface F extends A, B, C {} diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..2e08532845c8 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,104 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration extends-many TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: Array [], + + range: [28, 30], + loc: { + start: { column: 28, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + extends: Array [ + TSInterfaceHeritage { + type: "TSInterfaceHeritage", + expression: Identifier { + type: "Identifier", + name: "A", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + TSInterfaceHeritage { + type: "TSInterfaceHeritage", + expression: Identifier { + type: "Identifier", + name: "B", + + range: [23, 24], + loc: { + start: { column: 23, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [23, 24], + loc: { + start: { column: 23, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + TSInterfaceHeritage { + type: "TSInterfaceHeritage", + expression: Identifier { + type: "Identifier", + name: "C", + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + ], + id: Identifier { + type: "Identifier", + name: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, 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/TSInterfaceDeclaration/fixtures/extends-many/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..b5418859abc6 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration extends-many TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "interface", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "extends", + + range: [12, 19], + loc: { + start: { column: 12, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "A", + + range: [20, 21], + loc: { + start: { column: 20, 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: "B", + + range: [23, 24], + loc: { + start: { column: 23, 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: "C", + + 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/TSInterfaceDeclaration/fixtures/extends-many/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..18e1c620074b --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/3-Babel-AST.shot @@ -0,0 +1,104 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration extends-many Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: Array [], + + range: [28, 30], + loc: { + start: { column: 28, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + extends: Array [ + TSExpressionWithTypeArguments { + type: "TSExpressionWithTypeArguments", + expression: Identifier { + type: "Identifier", + name: "A", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + TSExpressionWithTypeArguments { + type: "TSExpressionWithTypeArguments", + expression: Identifier { + type: "Identifier", + name: "B", + + range: [23, 24], + loc: { + start: { column: 23, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [23, 24], + loc: { + start: { column: 23, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + TSExpressionWithTypeArguments { + type: "TSExpressionWithTypeArguments", + expression: Identifier { + type: "Identifier", + name: "C", + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + ], + id: Identifier { + type: "Identifier", + name: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, 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/TSInterfaceDeclaration/fixtures/extends-many/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..c6f5129d13f9 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,106 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration extends-many Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "interface", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "extends", + + range: [12, 19], + loc: { + start: { column: 12, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "A", + + range: [20, 21], + loc: { + start: { column: 20, 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: "B", + + range: [23, 24], + loc: { + start: { column: 23, 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: "C", + + 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/TSInterfaceDeclaration/fixtures/extends-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..793c00b7e980 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,114 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration extends-many AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSInterfaceDeclaration { + type: 'TSInterfaceDeclaration', + body: TSInterfaceBody { + type: 'TSInterfaceBody', + body: Array [], + + range: [28, 30], + loc: { + start: { column: 28, line: 1 }, + end: { column: 30, line: 1 }, + }, + }, + extends: Array [ +- TSInterfaceHeritage { +- type: 'TSInterfaceHeritage', ++ TSExpressionWithTypeArguments { ++ type: 'TSExpressionWithTypeArguments', + expression: Identifier { + type: 'Identifier', + name: 'A', + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, +- TSInterfaceHeritage { +- type: 'TSInterfaceHeritage', ++ TSExpressionWithTypeArguments { ++ type: 'TSExpressionWithTypeArguments', + expression: Identifier { + type: 'Identifier', + name: 'B', + + range: [23, 24], + loc: { + start: { column: 23, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + + range: [23, 24], + loc: { + start: { column: 23, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, +- TSInterfaceHeritage { +- type: 'TSInterfaceHeritage', ++ TSExpressionWithTypeArguments { ++ type: 'TSExpressionWithTypeArguments', + expression: Identifier { + type: 'Identifier', + name: 'C', + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + + range: [26, 27], + loc: { + start: { column: 26, line: 1 }, + end: { column: 27, line: 1 }, + }, + }, + ], + id: Identifier { + type: 'Identifier', + name: 'F', + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, 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/TSInterfaceDeclaration/fixtures/extends-many/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..c6ea1aca49b7 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-many/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,112 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration extends-many AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'interface', + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'F', + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Keyword { + type: 'Keyword', + value: 'extends', + + range: [12, 19], + loc: { + start: { column: 12, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'A', + + range: [20, 21], + loc: { + start: { column: 20, 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: 'B', + + range: [23, 24], + loc: { + start: { column: 23, 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: 'C', + + 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/TSInterfaceDeclaration/fixtures/extends-one/fixture.ts b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/fixture.ts new file mode 100644 index 000000000000..cd5394400b56 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/fixture.ts @@ -0,0 +1 @@ +interface F extends A {} diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..795dc661bbe4 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration extends-one TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: Array [], + + range: [22, 24], + loc: { + start: { column: 22, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + extends: Array [ + TSInterfaceHeritage { + type: "TSInterfaceHeritage", + expression: Identifier { + type: "Identifier", + name: "A", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + id: Identifier { + type: "Identifier", + name: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..b9e3f8a240d6 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration extends-one TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "interface", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "extends", + + range: [12, 19], + loc: { + start: { column: 12, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "A", + + 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/TSInterfaceDeclaration/fixtures/extends-one/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..87260af0dd55 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/3-Babel-AST.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration extends-one Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: Array [], + + range: [22, 24], + loc: { + start: { column: 22, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + extends: Array [ + TSExpressionWithTypeArguments { + type: "TSExpressionWithTypeArguments", + expression: Identifier { + type: "Identifier", + name: "A", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + id: Identifier { + type: "Identifier", + name: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..26da7a11f7cc --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration extends-one Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "interface", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Keyword { + type: "Keyword", + value: "extends", + + range: [12, 19], + loc: { + start: { column: 12, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "A", + + 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/TSInterfaceDeclaration/fixtures/extends-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..fe6cf12f1a56 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,72 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration extends-one AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSInterfaceDeclaration { + type: 'TSInterfaceDeclaration', + body: TSInterfaceBody { + type: 'TSInterfaceBody', + body: Array [], + + range: [22, 24], + loc: { + start: { column: 22, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + extends: Array [ +- TSInterfaceHeritage { +- type: 'TSInterfaceHeritage', ++ TSExpressionWithTypeArguments { ++ type: 'TSExpressionWithTypeArguments', + expression: Identifier { + type: 'Identifier', + name: 'A', + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + ], + id: Identifier { + type: 'Identifier', + name: 'F', + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 24, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 25], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..f12bb69db9bb --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/extends-one/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,72 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration extends-one AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'interface', + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'F', + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Keyword { + type: 'Keyword', + value: 'extends', + + range: [12, 19], + loc: { + start: { column: 12, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'A', + + 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/TSInterfaceDeclaration/fixtures/type-param-many/fixture.ts b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/fixture.ts new file mode 100644 index 000000000000..82042ece0e31 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/fixture.ts @@ -0,0 +1 @@ +interface F {} diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..6aea3322462f --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,119 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-many TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + 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: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + typeParameters: TSTypeParameterDeclaration { + type: "TSTypeParameterDeclaration", + params: Array [ + TSTypeParameter { + type: "TSTypeParameter", + in: false, + name: Identifier { + type: "Identifier", + name: "T", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + out: false, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + TSTypeParameter { + type: "TSTypeParameter", + in: false, + name: Identifier { + type: "Identifier", + name: "U", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + out: false, + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + TSTypeParameter { + type: "TSTypeParameter", + in: false, + name: Identifier { + type: "Identifier", + name: "V", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + out: false, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + + range: [11, 20], + loc: { + start: { column: 11, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..d96cb3d9489e --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-many TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "interface", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "U", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "V", + + 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 }, + }, + }, + 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/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..579e9191d103 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/3-Babel-AST.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-many Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + 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: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + typeParameters: TSTypeParameterDeclaration { + type: "TSTypeParameterDeclaration", + params: Array [ + TSTypeParameter { + type: "TSTypeParameter", + name: "T", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + TSTypeParameter { + type: "TSTypeParameter", + name: "U", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + TSTypeParameter { + type: "TSTypeParameter", + name: "V", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + + range: [11, 20], + loc: { + start: { column: 11, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..174304a412f4 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,116 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-many Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "interface", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "U", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "V", + + 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 }, + }, + }, + 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/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..56e43bd66323 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,126 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-many AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + 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: 'F', + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + typeParameters: TSTypeParameterDeclaration { + type: 'TSTypeParameterDeclaration', + params: Array [ + TSTypeParameter { + type: 'TSTypeParameter', +- in: false, +- name: Identifier { +- type: 'Identifier', +- name: 'T', +- +- range: [12, 13], +- loc: { +- start: { column: 12, line: 1 }, +- end: { column: 13, line: 1 }, +- }, +- }, +- out: false, ++ name: 'T', + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + TSTypeParameter { + type: 'TSTypeParameter', +- in: false, +- name: Identifier { +- type: 'Identifier', +- name: 'U', +- +- range: [15, 16], +- loc: { +- start: { column: 15, line: 1 }, +- end: { column: 16, line: 1 }, +- }, +- }, +- out: false, ++ name: 'U', + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + TSTypeParameter { + type: 'TSTypeParameter', +- in: false, +- name: Identifier { +- type: 'Identifier', +- name: 'V', +- +- range: [18, 19], +- loc: { +- start: { column: 18, line: 1 }, +- end: { column: 19, line: 1 }, +- }, +- }, +- out: false, ++ name: 'V', + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + + range: [11, 20], + loc: { + start: { column: 11, line: 1 }, + end: { column: 20, line: 1 }, + }, + }, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 23, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..889b7b8eba0e --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-many/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,122 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-many AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'interface', + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'F', + + 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 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'T', + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ',', + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'U', + + 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 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'V', + + 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 }, + }, + }, + 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/TSInterfaceDeclaration/fixtures/type-param-one/fixture.ts b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/fixture.ts new file mode 100644 index 000000000000..abd3720f1a68 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/fixture.ts @@ -0,0 +1 @@ +interface F {} diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..15f674485662 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,77 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-one TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: Array [], + + range: [15, 17], + loc: { + start: { column: 15, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + typeParameters: TSTypeParameterDeclaration { + type: "TSTypeParameterDeclaration", + params: Array [ + TSTypeParameter { + type: "TSTypeParameter", + in: false, + name: Identifier { + type: "Identifier", + name: "T", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + out: false, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + + range: [11, 14], + loc: { + start: { column: 11, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..d88a78ec4006 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-one TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "interface", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, 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: [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/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..dc81d623ecc1 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/3-Babel-AST.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-one Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: Array [], + + range: [15, 17], + loc: { + start: { column: 15, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + typeParameters: TSTypeParameterDeclaration { + type: "TSTypeParameterDeclaration", + params: Array [ + TSTypeParameter { + type: "TSTypeParameter", + name: "T", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + + range: [11, 14], + loc: { + start: { column: 11, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..a41373677b11 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-one Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "interface", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, 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: [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/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..d6859d52b512 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-one AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSInterfaceDeclaration { + type: 'TSInterfaceDeclaration', + body: TSInterfaceBody { + type: 'TSInterfaceBody', + body: Array [], + + range: [15, 17], + loc: { + start: { column: 15, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + id: Identifier { + type: 'Identifier', + name: 'F', + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + typeParameters: TSTypeParameterDeclaration { + type: 'TSTypeParameterDeclaration', + params: Array [ + TSTypeParameter { + type: 'TSTypeParameter', +- in: false, +- name: Identifier { +- type: 'Identifier', +- name: 'T', +- +- range: [12, 13], +- loc: { +- start: { column: 12, line: 1 }, +- end: { column: 13, line: 1 }, +- }, +- }, +- out: false, ++ name: 'T', + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + + range: [11, 14], + loc: { + start: { column: 11, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..fc20247a46e5 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/type-param-one/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration type-param-one AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'interface', + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'F', + + 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 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'T', + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, 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: [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/TSInterfaceDeclaration/fixtures/with-member-one/fixture.ts b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/fixture.ts new file mode 100644 index 000000000000..2f47465c4e0b --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/fixture.ts @@ -0,0 +1,3 @@ +interface F { + prop; +} diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..424cf585b19b --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration with-member-one TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: Array [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [16, 20], + loc: { + start: { column: 2, line: 2 }, + end: { column: 6, line: 2 }, + }, + }, + + range: [16, 21], + loc: { + start: { column: 2, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + ], + + range: [12, 23], + loc: { + start: { column: 12, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..c57ff756e66e --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration with-member-one TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "interface", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [16, 20], + loc: { + start: { column: 2, line: 2 }, + end: { column: 6, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [20, 21], + loc: { + start: { column: 6, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [22, 23], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..94437c371ec2 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/3-Babel-AST.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration with-member-one Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSInterfaceDeclaration { + type: "TSInterfaceDeclaration", + body: TSInterfaceBody { + type: "TSInterfaceBody", + body: Array [ + TSPropertySignature { + type: "TSPropertySignature", + computed: false, + key: Identifier { + type: "Identifier", + name: "prop", + + range: [16, 20], + loc: { + start: { column: 2, line: 2 }, + end: { column: 6, line: 2 }, + }, + }, + + range: [16, 21], + loc: { + start: { column: 2, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + ], + + range: [12, 23], + loc: { + start: { column: 12, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 1, line: 3 }, + }, + }, + ], + sourceType: "script", + + range: [0, 24], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 4 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..af379bd7026c --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration with-member-one Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "interface", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "prop", + + range: [16, 20], + loc: { + start: { column: 2, line: 2 }, + end: { column: 6, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [20, 21], + loc: { + start: { column: 6, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [22, 23], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..8e0b58b2efe7 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration with-member-one AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..32b0173342da --- /dev/null +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/fixtures/with-member-one/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,72 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSInterfaceDeclaration with-member-one AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'interface', + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'F', + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '{', + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'prop', + + range: [16, 20], + loc: { + start: { column: 2, line: 2 }, + end: { column: 6, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [20, 21], + loc: { + start: { column: 6, line: 2 }, + end: { column: 7, line: 2 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '}', + + range: [22, 23], + loc: { + start: { column: 0, line: 3 }, + end: { column: 1, line: 3 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/spec.ts index 1e95380c3cbb..a75c769daf92 100644 --- a/packages/ast-spec/src/declaration/TSInterfaceDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/TSInterfaceDeclaration/spec.ts @@ -7,11 +7,30 @@ import type { TSTypeParameterDeclaration } from '../../special/TSTypeParameterDe export interface TSInterfaceDeclaration extends BaseNode { type: AST_NODE_TYPES.TSInterfaceDeclaration; + // TODO(#4759) - breaking change remove this + abstract?: boolean; + /** + * The body of the interface + */ body: TSInterfaceBody; - id: Identifier; - typeParameters?: TSTypeParameterDeclaration; + /** + * Whether the interface was `declare`d, `undefined` otherwise + */ + // TODO(#5020) - make this `false` if it is not `declare`d + declare?: boolean; + /** + * The types this interface `extends` + */ extends?: TSInterfaceHeritage[]; + /** + * The name of this interface + */ + id: Identifier; + // TODO(#4759) - breaking change remove this implements?: TSInterfaceHeritage[]; - abstract?: boolean; - declare?: boolean; + /** + * The generic type parameters declared for the interface. + * This is `undefined` if there are no generic type parameters declared. + */ + typeParameters?: TSTypeParameterDeclaration; } diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/fixture.ts b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/fixture.ts new file mode 100644 index 000000000000..95cad2575043 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/fixture.ts @@ -0,0 +1 @@ +module 1 {} diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..082a7d854c2d --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration _error_ module-invalid-id TSESTree - Error 1`] = `[TSError: Namespace name cannot be '1'.]`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..9848b6e55cd4 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration _error_ module-invalid-id Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:6)]`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..1ed7cf1aba5a --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-invalid-id/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration _error_ module-invalid-id Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/fixture.ts b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/fixture.ts new file mode 100644 index 000000000000..7d0dcd8add30 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/fixture.ts @@ -0,0 +1 @@ +module F; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..0a8a833a27ad --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration _error_ module-missing-body TSESTree - Error 1`] = `[TSError: '{' expected.]`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..c7c0b7ca1d45 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration _error_ module-missing-body Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:8)]`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..f8381f6dde37 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/module-missing-body/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration _error_ module-missing-body Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/fixture.ts b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/fixture.ts new file mode 100644 index 000000000000..fe124427907e --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/fixture.ts @@ -0,0 +1 @@ +declare namespace F; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..6a1c0b8eebfd --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration _error_ namespace-declare-no-body TSESTree - Error 1`] = `[TSError: '{' expected.]`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..0cc4df30bc58 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration _error_ namespace-declare-no-body Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:19)]`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..62ff96dfe97d --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-declare-no-body/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration _error_ namespace-declare-no-body Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/fixture.ts b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/fixture.ts new file mode 100644 index 000000000000..173024ac6a33 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/fixture.ts @@ -0,0 +1 @@ +namespace 'a' {} diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..bdb99cfb914e --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration _error_ namespace-id-literal TSESTree - Error 1`] = `[TSError: Identifier expected.]`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..3dc7480d32a2 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration _error_ namespace-id-literal Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:9)]`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..354b7482759b --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-id-literal/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration _error_ namespace-id-literal Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/fixture.ts b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/fixture.ts new file mode 100644 index 000000000000..32cdae5da4b7 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/fixture.ts @@ -0,0 +1 @@ +namespace 1 {} diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..3fbcf961cfad --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration _error_ namespace-invalid-id TSESTree - Error 1`] = `[TSError: Namespace name cannot be '1'.]`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..be52f2461a2a --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration _error_ namespace-invalid-id Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:9)]`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..1a3abc42ed72 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-invalid-id/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration _error_ namespace-invalid-id Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/fixture.ts b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/fixture.ts new file mode 100644 index 000000000000..d0caf4acec49 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/fixture.ts @@ -0,0 +1 @@ +namespace F; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..33a26d312caf --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration _error_ namespace-no-body TSESTree - Error 1`] = `[TSError: '{' expected.]`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..4e9e941de863 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration _error_ namespace-no-body Babel - Error 1`] = `[SyntaxError: Unexpected token, expected "{" (1:11)]`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..2c9165727c10 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/_error_/namespace-no-body/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration _error_ namespace-no-body Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/fixture.ts b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/fixture.ts new file mode 100644 index 000000000000..3f1ee73dee12 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/fixture.ts @@ -0,0 +1 @@ +declare global {} diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..424909a0e10c --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,47 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration global TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [15, 17], + loc: { + start: { column: 15, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + declare: true, + global: true, + id: Identifier { + type: "Identifier", + name: "global", + + range: [8, 14], + loc: { + start: { column: 8, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..910131ba7b8c --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration global TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "global", + + range: [8, 14], + loc: { + start: { column: 8, 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..4e1a238040b4 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/3-Babel-AST.shot @@ -0,0 +1,47 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration global Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [15, 17], + loc: { + start: { column: 15, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + declare: true, + global: true, + id: Identifier { + type: "Identifier", + name: "global", + + range: [8, 14], + loc: { + start: { column: 8, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + + range: [0, 17], + loc: { + start: { column: 0, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 18], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..393012dfc4b8 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration global Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "global", + + range: [8, 14], + loc: { + start: { column: 8, 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..bdf259261537 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration global AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..b92eb152c95b --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/global/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration global AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/fixture.ts b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/fixture.ts new file mode 100644 index 000000000000..2758941f3c3a --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/fixture.ts @@ -0,0 +1 @@ +declare module 'a'; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..a0ad297f73cd --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,37 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-declare-no-body TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + declare: true, + id: Literal { + type: "Literal", + raw: "'a'", + value: "a", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..0c2959419e23 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-declare-no-body TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "module", + + range: [8, 14], + loc: { + start: { column: 8, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + String { + type: "String", + value: "'a'", + + range: [15, 18], + loc: { + start: { column: 15, 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/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..d90a0fdea6a6 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/3-Babel-AST.shot @@ -0,0 +1,37 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-declare-no-body Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + declare: true, + id: Literal { + type: "Literal", + raw: "'a'", + value: "a", + + range: [15, 18], + loc: { + start: { column: 15, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..d6f2b8430a15 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-declare-no-body Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "module", + + range: [8, 14], + loc: { + start: { column: 8, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + String { + type: "String", + value: "'a'", + + range: [15, 18], + loc: { + start: { column: 15, 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/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..29dc0c7a7765 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-declare-no-body AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..6341815959d2 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare-no-body/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-declare-no-body AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/fixture.ts b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/fixture.ts new file mode 100644 index 000000000000..2cbec48309b3 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/fixture.ts @@ -0,0 +1 @@ +declare module F {} diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..74a329eeb585 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-declare TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [17, 19], + loc: { + start: { column: 17, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + declare: true, + id: Identifier { + type: "Identifier", + name: "F", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..487f26037f87 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-declare TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "module", + + range: [8, 14], + loc: { + start: { column: 8, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [15, 16], + loc: { + start: { column: 15, 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/TSModuleDeclaration/fixtures/module-declare/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..dd00b5173a18 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/3-Babel-AST.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-declare Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [17, 19], + loc: { + start: { column: 17, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + declare: true, + id: Identifier { + type: "Identifier", + name: "F", + + range: [15, 16], + loc: { + start: { column: 15, line: 1 }, + end: { column: 16, line: 1 }, + }, + }, + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..e2dfc2330dcb --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-declare Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "module", + + range: [8, 14], + loc: { + start: { column: 8, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [15, 16], + loc: { + start: { column: 15, 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/TSModuleDeclaration/fixtures/module-declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..d70930f793c0 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-declare AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..bae19f0bd143 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-declare/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-declare AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/fixture.ts b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/fixture.ts new file mode 100644 index 000000000000..499f11944678 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/fixture.ts @@ -0,0 +1 @@ +module F {} diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..3559c1ce1a19 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,45 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-id-identifier TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [9, 11], + loc: { + start: { column: 9, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "F", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + + range: [0, 11], + loc: { + start: { column: 0, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..e8658090b431 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-id-identifier TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "module", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..7acb1bcd8716 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/3-Babel-AST.shot @@ -0,0 +1,45 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-id-identifier Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [9, 11], + loc: { + start: { column: 9, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "F", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + + range: [0, 11], + loc: { + start: { column: 0, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..f8093f686fb0 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-id-identifier Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "module", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..829de93e3df2 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-id-identifier AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..2d09487a6621 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-identifier/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-id-identifier AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/fixture.ts b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/fixture.ts new file mode 100644 index 000000000000..6e2ddacd2530 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/fixture.ts @@ -0,0 +1 @@ +module 'a' {} diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..da4f7cdc9afb --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-id-literal TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [11, 13], + loc: { + start: { column: 11, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + id: Literal { + type: "Literal", + raw: "'a'", + value: "a", + + range: [7, 10], + loc: { + start: { column: 7, 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/TSModuleDeclaration/fixtures/module-id-literal/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..35a1efd6dc9c --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-id-literal TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "module", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + String { + type: "String", + value: "'a'", + + range: [7, 10], + loc: { + start: { column: 7, 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/TSModuleDeclaration/fixtures/module-id-literal/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..fafc835ec472 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/3-Babel-AST.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-id-literal Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [11, 13], + loc: { + start: { column: 11, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + id: Literal { + type: "Literal", + raw: "'a'", + value: "a", + + range: [7, 10], + loc: { + start: { column: 7, 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/TSModuleDeclaration/fixtures/module-id-literal/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..a463f80b9e5b --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-id-literal Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "module", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + String { + type: "String", + value: "'a'", + + range: [7, 10], + loc: { + start: { column: 7, 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/TSModuleDeclaration/fixtures/module-id-literal/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..f13f22dfe7df --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-id-literal AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..1e1bc9d73c32 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-literal/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-id-literal AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/fixture.ts b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/fixture.ts new file mode 100644 index 000000000000..56162d5e58b1 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/fixture.ts @@ -0,0 +1 @@ +module A.B.C {} diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..3dfc069dda7e --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,83 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-id-qualified-name TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [13, 15], + loc: { + start: { column: 13, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "C", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [11, 15], + loc: { + start: { column: 11, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "B", + + 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 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "A", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, 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/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..70d7cd911e17 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-id-qualified-name TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "module", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "A", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ".", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "B", + + 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: "C", + + 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/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..c6af56a98835 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/3-Babel-AST.shot @@ -0,0 +1,83 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-id-qualified-name Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [13, 15], + loc: { + start: { column: 13, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "C", + + range: [11, 12], + loc: { + start: { column: 11, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + + range: [11, 15], + loc: { + start: { column: 11, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "B", + + 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 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "A", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, 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/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..b03c2f7b5a82 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-id-qualified-name Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "module", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "A", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ".", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "B", + + 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: "C", + + 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/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..d442f261db29 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-id-qualified-name AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..68241771f7c5 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/module-id-qualified-name/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration module-id-qualified-name AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/fixture.ts b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/fixture.ts new file mode 100644 index 000000000000..ebc35823e75d --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/fixture.ts @@ -0,0 +1 @@ +declare namespace F {} diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..c373a655222a --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-declare TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [20, 22], + loc: { + start: { column: 20, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + declare: true, + id: Identifier { + type: "Identifier", + name: "F", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..18d298125dde --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-declare TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "namespace", + + range: [8, 17], + loc: { + start: { column: 8, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, 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: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..269366508604 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/3-Babel-AST.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-declare Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [20, 22], + loc: { + start: { column: 20, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + declare: true, + id: Identifier { + type: "Identifier", + name: "F", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..374070330ed0 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-declare Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "namespace", + + range: [8, 17], + loc: { + start: { column: 8, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, 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: [21, 22], + loc: { + start: { column: 21, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..614b9695a3cf --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-declare AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..1e9fda98a787 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-declare/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-declare AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/fixture.ts b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/fixture.ts new file mode 100644 index 000000000000..fb1741b05b2d --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/fixture.ts @@ -0,0 +1 @@ +namespace F {} diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..e6303e2d3edc --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,45 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-id-identifier TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [12, 14], + loc: { + start: { column: 12, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..15cd21e3ad5d --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-id-identifier TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "namespace", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..2e47480e0447 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/3-Babel-AST.shot @@ -0,0 +1,45 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-id-identifier Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [12, 14], + loc: { + start: { column: 12, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..1fb07e00228d --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-id-identifier Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "namespace", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "F", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "{", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "}", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..a0aa056256bc --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-id-identifier AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..112e01d377c9 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-identifier/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-id-identifier AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/fixture.ts b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/fixture.ts new file mode 100644 index 000000000000..c7c1b751f8da --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/fixture.ts @@ -0,0 +1 @@ +namespace A.B.C {} diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..98cd5bbe8176 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,83 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-id-qualified-name TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [16, 18], + loc: { + start: { column: 16, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "C", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + + range: [14, 18], + loc: { + start: { column: 14, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "B", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [12, 18], + loc: { + start: { column: 12, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "A", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, 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/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..fcd5df00be87 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-id-qualified-name TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "namespace", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "A", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "B", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ".", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "C", + + 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/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..569b49fb3274 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/3-Babel-AST.shot @@ -0,0 +1,83 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-id-qualified-name Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleDeclaration { + type: "TSModuleDeclaration", + body: TSModuleBlock { + type: "TSModuleBlock", + body: Array [], + + range: [16, 18], + loc: { + start: { column: 16, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "C", + + range: [14, 15], + loc: { + start: { column: 14, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + + range: [14, 18], + loc: { + start: { column: 14, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "B", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + + range: [12, 18], + loc: { + start: { column: 12, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + id: Identifier { + type: "Identifier", + name: "A", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, 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/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..8f3b974a3ab1 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-id-qualified-name Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "namespace", + + range: [0, 9], + loc: { + start: { column: 0, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "A", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "B", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ".", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "C", + + 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/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..a7a16eee58a5 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-id-qualified-name AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..1e60c8843aae --- /dev/null +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/fixtures/namespace-id-qualified-name/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSModuleDeclaration namespace-id-qualified-name AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSModuleDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSModuleDeclaration/spec.ts index ac63e52a5938..e077d1648e1f 100644 --- a/packages/ast-spec/src/declaration/TSModuleDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/TSModuleDeclaration/spec.ts @@ -7,11 +7,24 @@ import type { Modifier } from '../../unions/Modifier'; export interface TSModuleDeclaration extends BaseNode { type: AST_NODE_TYPES.TSModuleDeclaration; + /** + * The name of the module + * ``` + * namespace A {} + * namespace A.B.C {} + * module 'a' {} + * ``` + */ id: Identifier | Literal; + /** + * The body of the module. + * This can only be `undefined` for the code `declare module 'mod';` + * This will be a `TSModuleDeclaration` if the name is "nested" (`Foo.Bar`). + */ body?: | TSModuleBlock /* - TODO - we currently emit this due to bad parser handling of nested modules + TODO(#4966) - we currently emit this due to bad parser handling of nested modules namespace Foo.Bar {} ^^^^^^^^^^^^^^^^^^^^ TSModuleDeclaration ^^^^^^ TSModuleDeclaration @@ -20,7 +33,22 @@ export interface TSModuleDeclaration extends BaseNode { This should instead emit a TSQualifiedName for the `id` and not emit an inner TSModuleDeclaration */ | TSModuleDeclaration; + /** + * Whether this is a global declaration + * ``` + * declare global {} + * ``` + */ + // TODO(#5020) - make this `false` if not `global` global?: boolean; + /** + * Whether the module is `declare`d + * ``` + * declare namespace F {} + * ``` + */ + // TODO(#5020) - make this `false` if it is not `declare`d declare?: boolean; + // TODO(#4759) - breaking change remove this modifiers?: Modifier[]; } diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/fixture.ts b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/fixture.ts new file mode 100644 index 000000000000..bbcfe5795de2 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/fixture.ts @@ -0,0 +1 @@ +export as namespace; diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..e47c9aa7c254 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSNamespaceExportDeclaration _error_ missing-id TSESTree - Error 1`] = `[TSError: Identifier expected.]`; diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..300850581d62 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSNamespaceExportDeclaration _error_ missing-id Babel - Error 1`] = `[SyntaxError: Unexpected token (1:19)]`; diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..0b5d774603fd --- /dev/null +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/missing-id/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSNamespaceExportDeclaration _error_ missing-id Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/non-identifier-name/fixture.ts b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/non-identifier-name/fixture.ts new file mode 100644 index 000000000000..a8878e61afef --- /dev/null +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/non-identifier-name/fixture.ts @@ -0,0 +1 @@ +export as namespace 1; diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..3e11b4700297 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/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 TSNamespaceExportDeclaration _error_ non-identifier-name TSESTree - Error 1`] = `[TSError: Identifier expected.]`; diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..f2641cc64de2 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/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 TSNamespaceExportDeclaration _error_ non-identifier-name Babel - Error 1`] = `[SyntaxError: Unexpected token (1:20)]`; diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/non-identifier-name/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/_error_/non-identifier-name/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..defe8a17bba2 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/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 TSNamespaceExportDeclaration _error_ non-identifier-name Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/fixture.ts b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/fixture.ts new file mode 100644 index 000000000000..ff8bbadf397d --- /dev/null +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/fixture.ts @@ -0,0 +1 @@ +export as namespace a; diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..914df1fad854 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,35 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSNamespaceExportDeclaration valid TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSNamespaceExportDeclaration { + type: "TSNamespaceExportDeclaration", + id: Identifier { + type: "Identifier", + name: "a", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..8399bbd3d1d7 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSNamespaceExportDeclaration valid 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: "as", + + range: [7, 9], + loc: { + start: { column: 7, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "namespace", + + range: [10, 19], + loc: { + start: { column: 10, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + range: [20, 21], + loc: { + start: { column: 20, 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..c3861bcab7bd --- /dev/null +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/3-Babel-AST.shot @@ -0,0 +1,35 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSNamespaceExportDeclaration valid Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSNamespaceExportDeclaration { + type: "TSNamespaceExportDeclaration", + id: Identifier { + type: "Identifier", + name: "a", + + range: [20, 21], + loc: { + start: { column: 20, line: 1 }, + end: { column: 21, line: 1 }, + }, + }, + + range: [0, 22], + loc: { + start: { column: 0, line: 1 }, + end: { column: 22, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 23], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..dfe3eae2d2ac --- /dev/null +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSNamespaceExportDeclaration valid 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: "as", + + range: [7, 9], + loc: { + start: { column: 7, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "namespace", + + range: [10, 19], + loc: { + start: { column: 10, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "a", + + range: [20, 21], + loc: { + start: { column: 20, 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..6cd11e1f4b30 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSNamespaceExportDeclaration valid AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..c7d4f1d7315f --- /dev/null +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/fixtures/valid/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSNamespaceExportDeclaration valid AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/spec.ts index 6853d4a28544..da63cca2ac69 100644 --- a/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/TSNamespaceExportDeclaration/spec.ts @@ -4,5 +4,8 @@ import type { Identifier } from '../../expression/Identifier/spec'; export interface TSNamespaceExportDeclaration extends BaseNode { type: AST_NODE_TYPES.TSNamespaceExportDeclaration; + /** + * The name the global variable being exported to + */ id: Identifier; } diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/fixture.ts b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/fixture.ts new file mode 100644 index 000000000000..3bd6bc6c6053 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/fixture.ts @@ -0,0 +1 @@ +type T<> = 1; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..9902528eb41d --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration _error_ missing-type-parameter TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..b18ec532458e --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration _error_ missing-type-parameter Babel - Error 1`] = `[SyntaxError: Type parameter list cannot be empty. (1:6)]`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..99587163b896 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration _error_ missing-type-parameter Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-name/fixture.ts b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-name/fixture.ts new file mode 100644 index 000000000000..533f0b183cf5 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-name/fixture.ts @@ -0,0 +1 @@ +type 1 = 2; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-name/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..7eaf3f0bba48 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/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 TSTypeAliasDeclaration _error_ non-identifier-name TSESTree - Error 1`] = `[TSError: Type alias name cannot be '1'.]`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-name/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..f7c419205f79 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/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 TSTypeAliasDeclaration _error_ non-identifier-name Babel - Error 1`] = `[SyntaxError: Missing semicolon. (1:4)]`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-name/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-name/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..7ccef6da61f4 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/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 TSTypeAliasDeclaration _error_ non-identifier-name Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/fixture.ts b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/fixture.ts new file mode 100644 index 000000000000..059c8eaf43d7 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/fixture.ts @@ -0,0 +1 @@ +type T<1> = 2; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..b11bc95c96d0 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration _error_ non-identifier-type-parameter TSESTree - Error 1`] = `[TSError: Type parameter declaration expected.]`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..bb7b44f3afec --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration _error_ non-identifier-type-parameter Babel - Error 1`] = `[SyntaxError: Unexpected token (1:7)]`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..ad412071cc11 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/_error_/non-identifier-type-parameter/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration _error_ non-identifier-type-parameter Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/fixture.ts b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/fixture.ts new file mode 100644 index 000000000000..87882321e287 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/fixture.ts @@ -0,0 +1 @@ +declare type T = 1; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..63becdaa218c --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration declare TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSTypeAliasDeclaration { + type: "TSTypeAliasDeclaration", + declare: true, + id: Identifier { + type: "Identifier", + name: "T", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + typeAnnotation: TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..8599ab306096 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration declare TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "type", + + range: [8, 12], + loc: { + start: { column: 8, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + 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/TSTypeAliasDeclaration/fixtures/declare/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..36939724fc47 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/3-Babel-AST.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration declare Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSTypeAliasDeclaration { + type: "TSTypeAliasDeclaration", + declare: true, + id: Identifier { + type: "Identifier", + name: "T", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + typeAnnotation: TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [17, 18], + loc: { + start: { column: 17, line: 1 }, + end: { column: 18, line: 1 }, + }, + }, + + range: [0, 19], + loc: { + start: { column: 0, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 20], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..48da9f1cfb8f --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,66 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration declare Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "type", + + range: [8, 12], + loc: { + start: { column: 8, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + 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/TSTypeAliasDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..890509a8dcbb --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration declare AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..6d9b60683b6e --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/declare/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration declare AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/fixture.ts b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/fixture.ts new file mode 100644 index 000000000000..98fb2f852da4 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/fixture.ts @@ -0,0 +1 @@ +type T = 1; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..af8a41ed4787 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,87 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-many TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSTypeAliasDeclaration { + type: "TSTypeAliasDeclaration", + id: Identifier { + type: "Identifier", + name: "T", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + typeAnnotation: TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [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 }, + }, + }, + typeParameters: TSTypeParameterDeclaration { + type: "TSTypeParameterDeclaration", + params: Array [ + TSTypeParameter { + type: "TSTypeParameter", + in: false, + name: Identifier { + type: "Identifier", + name: "U", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + out: false, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + ], + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..a84e1cc058d2 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-many TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "type", + + range: [0, 4], + loc: { + start: { column: 0, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "U", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [8, 9], + loc: { + start: { column: 8, 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 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..db6209388e74 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/3-Babel-AST.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-many Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSTypeAliasDeclaration { + type: "TSTypeAliasDeclaration", + id: Identifier { + type: "Identifier", + name: "T", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + typeAnnotation: TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [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 }, + }, + }, + typeParameters: TSTypeParameterDeclaration { + type: "TSTypeParameterDeclaration", + params: Array [ + TSTypeParameter { + type: "TSTypeParameter", + name: "U", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + ], + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..92442f10c0d8 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,86 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-many Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "type", + + range: [0, 4], + loc: { + start: { column: 0, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "U", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ">", + + range: [8, 9], + loc: { + start: { column: 8, 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 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..a80b5aa0a110 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,92 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-many AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', + id: Identifier { + type: 'Identifier', + name: 'T', + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [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 }, + }, + }, + typeParameters: TSTypeParameterDeclaration { + type: 'TSTypeParameterDeclaration', + params: Array [ + TSTypeParameter { + type: 'TSTypeParameter', +- in: false, +- name: Identifier { +- type: 'Identifier', +- name: 'U', +- +- range: [7, 8], +- loc: { +- start: { column: 7, line: 1 }, +- end: { column: 8, line: 1 }, +- }, +- }, +- out: false, ++ name: 'U', + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + ], + + range: [6, 9], + loc: { + start: { column: 6, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: 'script', + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, + }" +`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..b693d3c055dd --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-many/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-many AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/fixture.ts b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/fixture.ts new file mode 100644 index 000000000000..8ca0a9773130 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/fixture.ts @@ -0,0 +1 @@ +type T = 1; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..6bf2120e61b4 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,129 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-one TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSTypeAliasDeclaration { + type: "TSTypeAliasDeclaration", + id: Identifier { + type: "Identifier", + name: "T", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + typeAnnotation: TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + typeParameters: TSTypeParameterDeclaration { + type: "TSTypeParameterDeclaration", + params: Array [ + TSTypeParameter { + type: "TSTypeParameter", + in: false, + name: Identifier { + type: "Identifier", + name: "U", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + out: false, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + TSTypeParameter { + type: "TSTypeParameter", + in: false, + name: Identifier { + type: "Identifier", + name: "V", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + out: false, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + TSTypeParameter { + type: "TSTypeParameter", + in: false, + name: Identifier { + type: "Identifier", + name: "W", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + out: false, + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + + range: [6, 15], + loc: { + start: { column: 6, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + + 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/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..c23889fa8fd2 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,126 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-one TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "type", + + range: [0, 4], + loc: { + start: { column: 0, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "U", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "V", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "W", + + 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 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + 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/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..60c8977e60f3 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/3-Babel-AST.shot @@ -0,0 +1,96 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-one Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSTypeAliasDeclaration { + type: "TSTypeAliasDeclaration", + id: Identifier { + type: "Identifier", + name: "T", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + typeAnnotation: TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + typeParameters: TSTypeParameterDeclaration { + type: "TSTypeParameterDeclaration", + params: Array [ + TSTypeParameter { + type: "TSTypeParameter", + name: "U", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + TSTypeParameter { + type: "TSTypeParameter", + name: "V", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + TSTypeParameter { + type: "TSTypeParameter", + name: "W", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + + range: [6, 15], + loc: { + start: { column: 6, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + + 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/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..f6e56c2aa5fb --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,126 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-one Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "type", + + range: [0, 4], + loc: { + start: { column: 0, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "<", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "U", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "V", + + 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 }, + }, + }, + Identifier { + type: "Identifier", + value: "W", + + 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 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [16, 17], + loc: { + start: { column: 16, line: 1 }, + end: { column: 17, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + 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/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..d754f2bf397b --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,136 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-one AST Alignment - AST 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Program { + type: 'Program', + body: Array [ + TSTypeAliasDeclaration { + type: 'TSTypeAliasDeclaration', + id: Identifier { + type: 'Identifier', + name: 'T', + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + typeAnnotation: TSLiteralType { + type: 'TSLiteralType', + literal: Literal { + type: 'Literal', + raw: '1', + value: 1, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + + range: [18, 19], + loc: { + start: { column: 18, line: 1 }, + end: { column: 19, line: 1 }, + }, + }, + typeParameters: TSTypeParameterDeclaration { + type: 'TSTypeParameterDeclaration', + params: Array [ + TSTypeParameter { + type: 'TSTypeParameter', +- in: false, +- name: Identifier { +- type: 'Identifier', +- name: 'U', +- +- range: [7, 8], +- loc: { +- start: { column: 7, line: 1 }, +- end: { column: 8, line: 1 }, +- }, +- }, +- out: false, ++ name: 'U', + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + TSTypeParameter { + type: 'TSTypeParameter', +- in: false, +- name: Identifier { +- type: 'Identifier', +- name: 'V', +- +- range: [10, 11], +- loc: { +- start: { column: 10, line: 1 }, +- end: { column: 11, line: 1 }, +- }, +- }, +- out: false, ++ name: 'V', + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + TSTypeParameter { + type: 'TSTypeParameter', +- in: false, +- name: Identifier { +- type: 'Identifier', +- name: 'W', +- +- range: [13, 14], +- loc: { +- start: { column: 13, line: 1 }, +- end: { column: 14, line: 1 }, +- }, +- }, +- out: false, ++ name: 'W', + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + + range: [6, 15], + loc: { + start: { column: 6, line: 1 }, + end: { column: 15, line: 1 }, + }, + }, + + 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/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..bc7fa2d6aac4 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/type-param-one/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration type-param-one AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/fixture.ts b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/fixture.ts new file mode 100644 index 000000000000..0d6d62642cc2 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/fixture.ts @@ -0,0 +1 @@ +type T = 1; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..424ed29eb522 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,55 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration valid TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSTypeAliasDeclaration { + type: "TSTypeAliasDeclaration", + id: Identifier { + type: "Identifier", + name: "T", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + typeAnnotation: TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [0, 11], + loc: { + start: { column: 0, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..e3b35e444aa7 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration valid TSESTree - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "type", + + range: [0, 4], + loc: { + start: { column: 0, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + range: [5, 6], + loc: { + start: { column: 5, 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 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..7fad93c1cab8 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/3-Babel-AST.shot @@ -0,0 +1,55 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration valid Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + TSTypeAliasDeclaration { + type: "TSTypeAliasDeclaration", + id: Identifier { + type: "Identifier", + name: "T", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + typeAnnotation: TSLiteralType { + type: "TSLiteralType", + literal: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [9, 10], + loc: { + start: { column: 9, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + + range: [0, 11], + loc: { + start: { column: 0, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..12901c93f94c --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration valid Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "type", + + range: [0, 4], + loc: { + start: { column: 0, line: 1 }, + end: { column: 4, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "T", + + range: [5, 6], + loc: { + start: { column: 5, 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 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..9cc16a451ec1 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration valid AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..4de04778d631 --- /dev/null +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/fixtures/valid/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration TSTypeAliasDeclaration valid AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/spec.ts b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/spec.ts index 61ce986c2a23..15ab0a40c131 100644 --- a/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/TSTypeAliasDeclaration/spec.ts @@ -6,8 +6,25 @@ import type { TypeNode } from '../../unions/TypeNode'; export interface TSTypeAliasDeclaration extends BaseNode { type: AST_NODE_TYPES.TSTypeAliasDeclaration; + /** + * Whether the type was `declare`d. + * ``` + * declare type T = 1; + * ``` + */ + // TODO(#5020) - make this `false` if it is not `declare`d + declare?: boolean; + /** + * The name of the type. + */ id: Identifier; + /** + * The "value" (type) of the declaration + */ typeAnnotation: TypeNode; - declare?: boolean; + /** + * The generic type parameters declared for the type. + * This is `undefined` if there are no generic type parameters declared. + */ typeParameters?: TSTypeParameterDeclaration; } diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/fixture.ts new file mode 100644 index 000000000000..21a6e1beba95 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/fixture.ts @@ -0,0 +1 @@ +const = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..3f61a7ec4bde --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ missing-id-with-value TSESTree - Error 1`] = `[TSError: Variable declaration expected.]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..5e6f7bc3288b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ missing-id-with-value Babel - Error 1`] = `[SyntaxError: Unexpected token (1:6)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..830f2f4e93c8 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-with-value/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ missing-id-with-value Error Alignment 1`] = `"Both errored"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/fixture.ts new file mode 100644 index 000000000000..c53e6c279527 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/fixture.ts @@ -0,0 +1 @@ +const; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/1-TSESTree-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/1-TSESTree-Error.shot new file mode 100644 index 000000000000..6537d529262e --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/1-TSESTree-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ missing-id-without-value TSESTree - Error 1`] = `"NO ERROR"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/2-Babel-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/2-Babel-Error.shot new file mode 100644 index 000000000000..7a42d0e079b6 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/2-Babel-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ missing-id-without-value Babel - Error 1`] = `[SyntaxError: Unexpected token (1:5)]`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/3-Alignment-Error.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/3-Alignment-Error.shot new file mode 100644 index 000000000000..cd2401b6862d --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/snapshots/3-Alignment-Error.shot @@ -0,0 +1,3 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration _error_ missing-id-without-value Error Alignment 1`] = `"Babel errored but TSESTree didn't"`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/fixture.ts new file mode 100644 index 000000000000..943c458c79e2 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/fixture.ts @@ -0,0 +1 @@ +const x = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..d7290bd926df --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,58 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-with-value TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: Array [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [6, 11], + loc: { + start: { column: 6, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + kind: "const", + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..df6fc4d39980 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-with-value TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "const", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + 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/VariableDeclaration/fixtures/const-with-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..2cd36dbb4678 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/3-Babel-AST.shot @@ -0,0 +1,58 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-with-value Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: Array [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [6, 11], + loc: { + start: { column: 6, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + kind: "const", + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..5a5ce6855a2f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-with-value Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "const", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + 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/VariableDeclaration/fixtures/const-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..65c9ece0d433 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-with-value AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..abc02d7344bf --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-with-value/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-with-value AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/fixture.ts new file mode 100644 index 000000000000..943c458c79e2 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/fixture.ts @@ -0,0 +1 @@ +const x = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..ac4cd6b70d89 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,58 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-without-value TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: Array [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [6, 11], + loc: { + start: { column: 6, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + kind: "const", + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..ee275ed63d97 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-without-value TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "const", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + 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/VariableDeclaration/fixtures/const-without-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..c41b8219393c --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/3-Babel-AST.shot @@ -0,0 +1,58 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-without-value Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: Array [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + + range: [6, 11], + loc: { + start: { column: 6, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + kind: "const", + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..62b0896e9fd9 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-without-value Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "const", + + range: [0, 5], + loc: { + start: { column: 0, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + 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/VariableDeclaration/fixtures/const-without-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..56007597c389 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-without-value AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..cc37accf3c50 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/const-without-value/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration const-without-value AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/fixture.ts new file mode 100644 index 000000000000..3dc63502e9ca --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/fixture.ts @@ -0,0 +1 @@ +declare let x; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..19c59fcc338c --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,49 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: Array [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + init: null, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + declare: true, + kind: "let", + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..5e3638b00d8f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration 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: "let", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..9cd49f740e41 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/3-Babel-AST.shot @@ -0,0 +1,49 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: Array [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + init: null, + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + ], + declare: true, + kind: "let", + + range: [0, 14], + loc: { + start: { column: 0, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 15], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..5b7e380551c3 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,46 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "declare", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "let", + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..005dc078e1de --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..6d4eee5276a1 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/declare/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,52 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration declare AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ + Identifier { + type: 'Identifier', + value: 'declare', + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'let', + + range: [8, 11], + loc: { + start: { column: 8, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'x', + + range: [12, 13], + loc: { + start: { column: 12, line: 1 }, + end: { column: 13, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [13, 14], + loc: { + start: { column: 13, line: 1 }, + end: { column: 14, line: 1 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/fixture.ts new file mode 100644 index 000000000000..db9133994486 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/fixture.ts @@ -0,0 +1 @@ +let x = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..a1c7625b4576 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,58 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-with-value TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: Array [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [4, 9], + loc: { + start: { column: 4, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + ], + kind: "let", + + range: [0, 10], + loc: { + start: { column: 0, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 11], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..fa835fcdd32a --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-with-value TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "let", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [8, 9], + loc: { + start: { column: 8, 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..5c5236d0482c --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/3-Babel-AST.shot @@ -0,0 +1,58 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-with-value Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: Array [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [4, 9], + loc: { + start: { column: 4, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + ], + kind: "let", + + range: [0, 10], + loc: { + start: { column: 0, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 11], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..6f4bc74a6bd3 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-with-value Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "let", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [8, 9], + loc: { + start: { column: 8, 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..2697799a4159 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-with-value AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..e8e2c1727b2f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-with-value/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,62 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-with-value AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'let', + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'x', + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: '=', + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Numeric { + type: 'Numeric', + value: '1', + + range: [8, 9], + loc: { + start: { column: 8, 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 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/fixture.ts new file mode 100644 index 000000000000..2756c24c4577 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/fixture.ts @@ -0,0 +1 @@ +let x; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..86d5e5fb9d11 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,48 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-without-value TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: Array [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + init: null, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + ], + kind: "let", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..66e4c76e5674 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-without-value TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "let", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..78ac80c4cf49 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/3-Babel-AST.shot @@ -0,0 +1,48 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-without-value Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: Array [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + init: null, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + ], + kind: "let", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..78f58826ca69 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-without-value Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "let", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..8082a31f808a --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-without-value AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..949c66669c79 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/let-without-value/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,42 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration let-without-value AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'let', + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'x', + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ';', + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + ]" +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/fixture.ts new file mode 100644 index 000000000000..6736426d70f2 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/fixture.ts @@ -0,0 +1 @@ +let x, y, z; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..f34767c5d507 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration multiple-declarations TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: Array [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + init: null, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "y", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + init: null, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "z", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + init: null, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + kind: "let", + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..b47b272ca688 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration multiple-declarations TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "let", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "y", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "z", + + 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/VariableDeclaration/fixtures/multiple-declarations/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..b52ef7582475 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/3-Babel-AST.shot @@ -0,0 +1,88 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration multiple-declarations Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: Array [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + init: null, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "y", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + init: null, + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "z", + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + init: null, + + range: [10, 11], + loc: { + start: { column: 10, line: 1 }, + end: { column: 11, line: 1 }, + }, + }, + ], + kind: "let", + + range: [0, 12], + loc: { + start: { column: 0, line: 1 }, + end: { column: 12, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 13], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..2e324512abe7 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,76 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration multiple-declarations Babel - Tokens 1`] = ` +Array [ + Identifier { + type: "Identifier", + value: "let", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "y", + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ",", + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "z", + + 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/VariableDeclaration/fixtures/multiple-declarations/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..10b9167907cb --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration multiple-declarations AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..d1e4b8c9a7b5 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/multiple-declarations/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,82 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration multiple-declarations AST Alignment - Token 1`] = ` +"Snapshot Diff: +- TSESTree ++ Babel + + Array [ +- Keyword { +- type: 'Keyword', ++ Identifier { ++ type: 'Identifier', + value: 'let', + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'x', + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ',', + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'y', + + range: [7, 8], + loc: { + start: { column: 7, line: 1 }, + end: { column: 8, line: 1 }, + }, + }, + Punctuator { + type: 'Punctuator', + value: ',', + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + Identifier { + type: 'Identifier', + value: 'z', + + 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/VariableDeclaration/fixtures/var-with-value/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/fixture.ts new file mode 100644 index 000000000000..b506100a909f --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/fixture.ts @@ -0,0 +1 @@ +var x = 1; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..d0b455dc1a23 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,58 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-with-value TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: Array [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [4, 9], + loc: { + start: { column: 4, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + ], + kind: "var", + + range: [0, 10], + loc: { + start: { column: 0, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 11], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..2f9b9d787042 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-with-value TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "var", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [8, 9], + loc: { + start: { column: 8, 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..1420d42a8ca0 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/3-Babel-AST.shot @@ -0,0 +1,58 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-with-value Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: Array [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + init: Literal { + type: "Literal", + raw: "1", + value: 1, + + range: [8, 9], + loc: { + start: { column: 8, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + + range: [4, 9], + loc: { + start: { column: 4, line: 1 }, + end: { column: 9, line: 1 }, + }, + }, + ], + kind: "var", + + range: [0, 10], + loc: { + start: { column: 0, line: 1 }, + end: { column: 10, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 11], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..bbab28532c67 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,56 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-with-value Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "var", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: "=", + + range: [6, 7], + loc: { + start: { column: 6, line: 1 }, + end: { column: 7, line: 1 }, + }, + }, + Numeric { + type: "Numeric", + value: "1", + + range: [8, 9], + loc: { + start: { column: 8, 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 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..b107c9499d49 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-with-value AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..1eb3bcd0b986 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-with-value/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-with-value AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/fixture.ts b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/fixture.ts new file mode 100644 index 000000000000..96f6d3a3f15b --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/fixture.ts @@ -0,0 +1 @@ +var x; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/1-TSESTree-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/1-TSESTree-AST.shot new file mode 100644 index 000000000000..9af840c2c538 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/1-TSESTree-AST.shot @@ -0,0 +1,48 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-without-value TSESTree - AST 1`] = ` +Program { + type: "Program", + body: Array [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: Array [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + init: null, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + ], + kind: "var", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/2-TSESTree-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/2-TSESTree-Tokens.shot new file mode 100644 index 000000000000..ba7245b545ed --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/2-TSESTree-Tokens.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-without-value TSESTree - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "var", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/3-Babel-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/3-Babel-AST.shot new file mode 100644 index 000000000000..a3bb2551bf26 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/3-Babel-AST.shot @@ -0,0 +1,48 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-without-value Babel - AST 1`] = ` +Program { + type: "Program", + body: Array [ + VariableDeclaration { + type: "VariableDeclaration", + declarations: Array [ + VariableDeclarator { + type: "VariableDeclarator", + id: Identifier { + type: "Identifier", + name: "x", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + init: null, + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + ], + kind: "var", + + range: [0, 6], + loc: { + start: { column: 0, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, + ], + sourceType: "script", + + range: [0, 7], + loc: { + start: { column: 0, line: 1 }, + end: { column: 0, line: 2 }, + }, +} +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/4-Babel-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/4-Babel-Tokens.shot new file mode 100644 index 000000000000..289daee1ace2 --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/4-Babel-Tokens.shot @@ -0,0 +1,36 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-without-value Babel - Tokens 1`] = ` +Array [ + Keyword { + type: "Keyword", + value: "var", + + range: [0, 3], + loc: { + start: { column: 0, line: 1 }, + end: { column: 3, line: 1 }, + }, + }, + Identifier { + type: "Identifier", + value: "x", + + range: [4, 5], + loc: { + start: { column: 4, line: 1 }, + end: { column: 5, line: 1 }, + }, + }, + Punctuator { + type: "Punctuator", + value: ";", + + range: [5, 6], + loc: { + start: { column: 5, line: 1 }, + end: { column: 6, line: 1 }, + }, + }, +] +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/5-AST-Alignment-AST.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/5-AST-Alignment-AST.shot new file mode 100644 index 000000000000..b8594239a06c --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/5-AST-Alignment-AST.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-without-value AST Alignment - AST 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/6-AST-Alignment-Tokens.shot b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/6-AST-Alignment-Tokens.shot new file mode 100644 index 000000000000..3d401ca8c69e --- /dev/null +++ b/packages/ast-spec/src/declaration/VariableDeclaration/fixtures/var-without-value/snapshots/6-AST-Alignment-Tokens.shot @@ -0,0 +1,6 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`AST Fixtures declaration VariableDeclaration var-without-value AST Alignment - Token 1`] = ` +"Snapshot Diff: +Compared values have no visual difference." +`; diff --git a/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts b/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts index 418a51eb735b..4bc9b0f48541 100644 --- a/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts +++ b/packages/ast-spec/src/declaration/VariableDeclaration/spec.ts @@ -4,8 +4,31 @@ import type { VariableDeclarator } from '../../special/VariableDeclarator/spec'; export interface VariableDeclaration extends BaseNode { type: AST_NODE_TYPES.VariableDeclaration; - // NOTE - this is not guaranteed to have any elements in it. i.e. `const;` + /** + * The variables declared by this declaration. + * Note that there may be 0 declarations (i.e. `const;`). + * ``` + * let x; + * let y, z; + * ``` + */ + // TODO(#1852) - this should be guaranteed to have at least 1 element in it. declarations: VariableDeclarator[]; - kind: 'const' | 'let' | 'var'; + /** + * Whether the declaration is `declare`d + * ``` + * declare const x = 1; + * ``` + */ + // TODO(#5020) - make this `false` if it is not `declare`d declare?: boolean; + /** + * The keyword used to declare the variable(s) + * ``` + * const x = 1; + * let y = 2; + * var z = 3; + * ``` + */ + kind: 'const' | 'let' | 'var'; } diff --git a/packages/ast-spec/src/expression/ArrayExpression/spec.ts b/packages/ast-spec/src/expression/ArrayExpression/spec.ts index 7da330e231a4..7dc07e30952b 100644 --- a/packages/ast-spec/src/expression/ArrayExpression/spec.ts +++ b/packages/ast-spec/src/expression/ArrayExpression/spec.ts @@ -1,8 +1,9 @@ import type { AST_NODE_TYPES } from '../../ast-node-types'; import type { BaseNode } from '../../base/BaseNode'; +import type { SpreadElement } from '../../element/SpreadElement/spec'; import type { Expression } from '../../unions/Expression'; export interface ArrayExpression extends BaseNode { type: AST_NODE_TYPES.ArrayExpression; - elements: Expression[]; + elements: (Expression | SpreadElement)[]; } diff --git a/packages/ast-spec/src/expression/ClassExpression/spec.ts b/packages/ast-spec/src/expression/ClassExpression/spec.ts index 15215c31f1b6..dfe6c0d1b41d 100644 --- a/packages/ast-spec/src/expression/ClassExpression/spec.ts +++ b/packages/ast-spec/src/expression/ClassExpression/spec.ts @@ -1,6 +1,9 @@ import type { AST_NODE_TYPES } from '../../ast-node-types'; -import type { ClassDeclarationBase } from '../../base/ClassDeclarationBase'; +import type { ClassBase } from '../../base/ClassBase'; -export interface ClassExpression extends ClassDeclarationBase { +export interface ClassExpression extends ClassBase { type: AST_NODE_TYPES.ClassExpression; + abstract?: undefined; + declare?: undefined; + decorators?: undefined; } diff --git a/packages/ast-spec/src/expression/FunctionExpression/spec.ts b/packages/ast-spec/src/expression/FunctionExpression/spec.ts index 111be168b024..41f592a972f0 100644 --- a/packages/ast-spec/src/expression/FunctionExpression/spec.ts +++ b/packages/ast-spec/src/expression/FunctionExpression/spec.ts @@ -1,8 +1,9 @@ import type { AST_NODE_TYPES } from '../../ast-node-types'; -import type { FunctionDeclarationBase } from '../../base/FunctionDeclarationBase'; +import type { FunctionBase } from '../../base/FunctionBase'; import type { BlockStatement } from '../../statement/BlockStatement/spec'; -export interface FunctionExpression extends FunctionDeclarationBase { +export interface FunctionExpression extends FunctionBase { type: AST_NODE_TYPES.FunctionExpression; body: BlockStatement; + expression: false; } diff --git a/packages/ast-spec/src/expression/TSEmptyBodyFunctionExpression/spec.ts b/packages/ast-spec/src/expression/TSEmptyBodyFunctionExpression/spec.ts index 2cc413c01095..77c8779c7d14 100644 --- a/packages/ast-spec/src/expression/TSEmptyBodyFunctionExpression/spec.ts +++ b/packages/ast-spec/src/expression/TSEmptyBodyFunctionExpression/spec.ts @@ -1,7 +1,8 @@ import type { AST_NODE_TYPES } from '../../ast-node-types'; -import type { FunctionDeclarationBase } from '../../base/FunctionDeclarationBase'; +import type { FunctionBase } from '../../base/FunctionBase'; -export interface TSEmptyBodyFunctionExpression extends FunctionDeclarationBase { +export interface TSEmptyBodyFunctionExpression extends FunctionBase { type: AST_NODE_TYPES.TSEmptyBodyFunctionExpression; body: null; + id: null; } diff --git a/packages/ast-spec/src/expression/TSInstantiationExpression/spec.ts b/packages/ast-spec/src/expression/TSInstantiationExpression/spec.ts new file mode 100644 index 000000000000..c0a9f9fd99b7 --- /dev/null +++ b/packages/ast-spec/src/expression/TSInstantiationExpression/spec.ts @@ -0,0 +1,10 @@ +import type { AST_NODE_TYPES } from '../../ast-node-types'; +import type { BaseNode } from '../../base/BaseNode'; +import type { TSTypeParameterInstantiation } from '../../special/spec'; +import type { Expression } from '../../unions/Expression'; + +export interface TSInstantiationExpression extends BaseNode { + type: AST_NODE_TYPES.TSInstantiationExpression; + expression: Expression; + typeParameters: TSTypeParameterInstantiation; +} diff --git a/packages/ast-spec/src/expression/spec.ts b/packages/ast-spec/src/expression/spec.ts index 9ea054546202..9ed4a0cc7561 100644 --- a/packages/ast-spec/src/expression/spec.ts +++ b/packages/ast-spec/src/expression/spec.ts @@ -21,6 +21,7 @@ export * from './SequenceExpression/spec'; export * from './Super/spec'; export * from './TSAsExpression/spec'; export * from './TSEmptyBodyFunctionExpression/spec'; +export * from './TSInstantiationExpression/spec'; export * from './TSNonNullExpression/spec'; export * from './TSTypeAssertion/spec'; export * from './TaggedTemplateExpression/spec'; diff --git a/packages/ast-spec/src/special/TSExternalModuleReference/spec.ts b/packages/ast-spec/src/special/TSExternalModuleReference/spec.ts index e634d4d0d6e9..1efd283fd8cf 100644 --- a/packages/ast-spec/src/special/TSExternalModuleReference/spec.ts +++ b/packages/ast-spec/src/special/TSExternalModuleReference/spec.ts @@ -4,5 +4,6 @@ import type { Expression } from '../../unions/Expression'; export interface TSExternalModuleReference extends BaseNode { type: AST_NODE_TYPES.TSExternalModuleReference; + // TODO(#1852) - this must be a string expression: Expression; } diff --git a/packages/ast-spec/src/special/TSTypeParameter/spec.ts b/packages/ast-spec/src/special/TSTypeParameter/spec.ts index 61d75a6a29ed..7487e4f56177 100644 --- a/packages/ast-spec/src/special/TSTypeParameter/spec.ts +++ b/packages/ast-spec/src/special/TSTypeParameter/spec.ts @@ -8,4 +8,6 @@ export interface TSTypeParameter extends BaseNode { name: Identifier; constraint?: TypeNode; default?: TypeNode; + in: boolean; + out: boolean; } diff --git a/packages/ast-spec/src/unions/ExportDeclaration.ts b/packages/ast-spec/src/unions/ExportDeclaration.ts index 1ae9d9ddb9f8..b78996d14053 100644 --- a/packages/ast-spec/src/unions/ExportDeclaration.ts +++ b/packages/ast-spec/src/unions/ExportDeclaration.ts @@ -1,20 +1,48 @@ -import type { ClassDeclaration } from '../declaration/ClassDeclaration/spec'; -import type { FunctionDeclaration } from '../declaration/FunctionDeclaration/spec'; +import type { + ClassDeclarationWithName, + ClassDeclarationWithOptionalName, +} from '../declaration/ClassDeclaration/spec'; +import type { + FunctionDeclarationWithName, + FunctionDeclarationWithOptionalName, +} from '../declaration/FunctionDeclaration/spec'; import type { TSDeclareFunction } from '../declaration/TSDeclareFunction/spec'; import type { TSEnumDeclaration } from '../declaration/TSEnumDeclaration/spec'; import type { TSInterfaceDeclaration } from '../declaration/TSInterfaceDeclaration/spec'; import type { TSModuleDeclaration } from '../declaration/TSModuleDeclaration/spec'; import type { TSTypeAliasDeclaration } from '../declaration/TSTypeAliasDeclaration/spec'; import type { VariableDeclaration } from '../declaration/VariableDeclaration/spec'; -import type { ClassExpression } from '../expression/ClassExpression/spec'; +import type { Expression } from './Expression'; -export type ExportDeclaration = - | ClassDeclaration - | ClassExpression - | FunctionDeclaration +// TODO(#1852) - the following are disallowed syntactically, but allowed by TS error recovery: +// TSEnumDeclaration, TSModuleDeclaration, TSTypeAliasDeclaration, VariableDeclaration +export type DefaultExportDeclarations = + | ClassDeclarationWithOptionalName + | Expression + | FunctionDeclarationWithName + | FunctionDeclarationWithOptionalName + | TSDeclareFunction + | TSEnumDeclaration + | TSInterfaceDeclaration + | TSModuleDeclaration + | TSTypeAliasDeclaration + | VariableDeclaration; + +// TODO(#1852) - the following are disallowed syntactically, but allowed by TS error recovery: +// ClassDeclarationWithOptionalName, FunctionDeclarationWithOptionalName +export type NamedExportDeclarations = + | ClassDeclarationWithName + | ClassDeclarationWithOptionalName + | FunctionDeclarationWithName + | FunctionDeclarationWithOptionalName | TSDeclareFunction | TSEnumDeclaration | TSInterfaceDeclaration | TSModuleDeclaration | TSTypeAliasDeclaration | VariableDeclaration; + +// TODO - breaking change remove this in the next major +export type ExportDeclaration = + | DefaultExportDeclarations + | NamedExportDeclarations; diff --git a/packages/ast-spec/src/unions/Expression.ts b/packages/ast-spec/src/unions/Expression.ts index 5359dc9c69c7..36220bc03919 100644 --- a/packages/ast-spec/src/unions/Expression.ts +++ b/packages/ast-spec/src/unions/Expression.ts @@ -23,6 +23,7 @@ import type { TaggedTemplateExpression } from '../expression/TaggedTemplateExpre import type { TemplateLiteral } from '../expression/TemplateLiteral/spec'; import type { ThisExpression } from '../expression/ThisExpression/spec'; import type { TSAsExpression } from '../expression/TSAsExpression/spec'; +import type { TSInstantiationExpression } from '../expression/TSInstantiationExpression/spec'; import type { TSNonNullExpression } from '../expression/TSNonNullExpression/spec'; import type { TSTypeAssertion } from '../expression/TSTypeAssertion/spec'; import type { UnaryExpression } from '../expression/UnaryExpression/spec'; @@ -69,6 +70,7 @@ export type Expression = | TemplateLiteral | ThisExpression | TSAsExpression + | TSInstantiationExpression | TSNonNullExpression | TSTypeAssertion | UnaryExpression diff --git a/packages/ast-spec/src/unions/Node.ts b/packages/ast-spec/src/unions/Node.ts index b031d3bd348e..f6d4cbafffd1 100644 --- a/packages/ast-spec/src/unions/Node.ts +++ b/packages/ast-spec/src/unions/Node.ts @@ -51,6 +51,7 @@ import type { TemplateLiteral } from '../expression/TemplateLiteral/spec'; import type { ThisExpression } from '../expression/ThisExpression/spec'; import type { TSAsExpression } from '../expression/TSAsExpression/spec'; import type { TSEmptyBodyFunctionExpression } from '../expression/TSEmptyBodyFunctionExpression/spec'; +import type { TSInstantiationExpression } from '../expression/TSInstantiationExpression/spec'; import type { TSNonNullExpression } from '../expression/TSNonNullExpression/spec'; import type { TSTypeAssertion } from '../expression/TSTypeAssertion/spec'; import type { UnaryExpression } from '../expression/UnaryExpression/spec'; @@ -277,6 +278,7 @@ export type Node = | TSIndexedAccessType | TSIndexSignature | TSInferType + | TSInstantiationExpression | TSInterfaceBody | TSInterfaceDeclaration | TSInterfaceHeritage diff --git a/packages/ast-spec/src/unions/Statement.ts b/packages/ast-spec/src/unions/Statement.ts index e1af96b7fe5d..56a4cfaf1ae9 100644 --- a/packages/ast-spec/src/unions/Statement.ts +++ b/packages/ast-spec/src/unions/Statement.ts @@ -1,8 +1,8 @@ -import type { ClassDeclaration } from '../declaration/ClassDeclaration/spec'; +import type { ClassDeclarationWithName } from '../declaration/ClassDeclaration/spec'; import type { ExportAllDeclaration } from '../declaration/ExportAllDeclaration/spec'; import type { ExportDefaultDeclaration } from '../declaration/ExportDefaultDeclaration/spec'; import type { ExportNamedDeclaration } from '../declaration/ExportNamedDeclaration/spec'; -import type { FunctionDeclaration } from '../declaration/FunctionDeclaration/spec'; +import type { FunctionDeclarationWithName } from '../declaration/FunctionDeclaration/spec'; import type { ImportDeclaration } from '../declaration/ImportDeclaration/spec'; import type { TSDeclareFunction } from '../declaration/TSDeclareFunction/spec'; import type { TSEnumDeclaration } from '../declaration/TSEnumDeclaration/spec'; @@ -34,7 +34,7 @@ import type { WithStatement } from '../statement/WithStatement/spec'; export type Statement = | BlockStatement | BreakStatement - | ClassDeclaration + | ClassDeclarationWithName | ContinueStatement | DebuggerStatement | DoWhileStatement @@ -45,7 +45,7 @@ export type Statement = | ForInStatement | ForOfStatement | ForStatement - | FunctionDeclaration + | FunctionDeclarationWithName | IfStatement | ImportDeclaration | LabeledStatement @@ -75,4 +75,4 @@ export type ProgramStatement = | TSImportEqualsDeclaration | TSNamespaceExportDeclaration; -// TODO - once we have syntax errors, the types in ProgramStatement should not be in Statement +// TODO(#1852) - the types in ProgramStatement should not be in Statement diff --git a/packages/ast-spec/tests/fixtures-with-differences-ast.shot b/packages/ast-spec/tests/fixtures-with-differences-ast.shot index 2a37d6b6582d..9d3e5d88ccca 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-ast.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-ast.shot @@ -4,13 +4,25 @@ 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/ClassDeclaration/fixtures/type-param/fixture.ts", + "declaration/ClassDeclaration/fixtures/type-parameters-extends-type-param/fixture.ts", + "declaration/ClassDeclaration/fixtures/with-member-one/fixture.ts", "declaration/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", + "declaration/FunctionDeclaration/fixtures/type-param-many/fixture.ts", + "declaration/FunctionDeclaration/fixtures/type-param-one/fixture.ts", + "declaration/TSDeclareFunction/fixtures/type-param-many/fixture.ts", + "declaration/TSDeclareFunction/fixtures/type-param-one/fixture.ts", + "declaration/TSImportEqualsDeclaration/fixtures/external-module-ref-string/fixture.ts", + "declaration/TSInterfaceDeclaration/fixtures/extends-many/fixture.ts", + "declaration/TSInterfaceDeclaration/fixtures/extends-one/fixture.ts", + "declaration/TSInterfaceDeclaration/fixtures/type-param-many/fixture.ts", + "declaration/TSInterfaceDeclaration/fixtures/type-param-one/fixture.ts", + "declaration/TSTypeAliasDeclaration/fixtures/type-param-many/fixture.ts", + "declaration/TSTypeAliasDeclaration/fixtures/type-param-one/fixture.ts", } `; diff --git a/packages/ast-spec/tests/fixtures-with-differences-errors.shot b/packages/ast-spec/tests/fixtures-with-differences-errors.shot index 59b5c479a758..f9c7ef6147dd 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-errors.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-errors.shot @@ -4,8 +4,22 @@ 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/ClassDeclaration/fixtures/_error_/missing-extends-type-param/fixture.ts", + "declaration/ClassDeclaration/fixtures/_error_/missing-type-param/fixture.ts", + "declaration/ExportAllDeclaration/fixtures/_error_/kind-type/fixture.ts", "declaration/ExportAllDeclaration/fixtures/_error_/type-kind/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/_error_/anonymous-class/fixture.ts", + "declaration/FunctionDeclaration/fixtures/_error_/missing-type-param/fixture.ts", + "declaration/TSDeclareFunction/fixtures/_error_/async/fixture.ts", + "declaration/TSDeclareFunction/fixtures/_error_/declare-with-body/fixture.ts", + "declaration/TSDeclareFunction/fixtures/_error_/missing-type-param/fixture.ts", + "declaration/TSImportEqualsDeclaration/fixtures/_error_/external-module-ref-non-string/fixture.ts", + "declaration/TSImportEqualsDeclaration/fixtures/_error_/import-kind/fixture.ts", + "declaration/TSInterfaceDeclaration/fixtures/_error_/missing-extends/fixture.ts", + "declaration/TSInterfaceDeclaration/fixtures/_error_/missing-type-param/fixture.ts", + "declaration/TSInterfaceDeclaration/fixtures/_error_/non-identifier-extends/fixture.ts", + "declaration/TSTypeAliasDeclaration/fixtures/_error_/missing-type-parameter/fixture.ts", + "declaration/VariableDeclaration/fixtures/_error_/missing-id-without-value/fixture.ts", }, "TSESTree errored but Babel didn't": Set { "declaration/ExportAllDeclaration/fixtures/_error_/named-non-identifier/fixture.ts", diff --git a/packages/ast-spec/tests/fixtures-with-differences-tokens.shot b/packages/ast-spec/tests/fixtures-with-differences-tokens.shot index 6c8d721a41a5..ee92fc9b050c 100644 --- a/packages/ast-spec/tests/fixtures-with-differences-tokens.shot +++ b/packages/ast-spec/tests/fixtures-with-differences-tokens.shot @@ -7,5 +7,20 @@ Set { "declaration/ExportDefaultDeclaration/fixtures/interface/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/enum/fixture.ts", "declaration/ExportNamedDeclaration/fixtures/interface/fixture.ts", + "declaration/TSEnumDeclaration/fixtures/const/fixture.ts", + "declaration/TSEnumDeclaration/fixtures/declare/fixture.ts", + "declaration/TSEnumDeclaration/fixtures/empty/fixture.ts", + "declaration/TSEnumDeclaration/fixtures/with-member-one/fixture.ts", + "declaration/TSInterfaceDeclaration/fixtures/declare/fixture.ts", + "declaration/TSInterfaceDeclaration/fixtures/empty/fixture.ts", + "declaration/TSInterfaceDeclaration/fixtures/extends-many/fixture.ts", + "declaration/TSInterfaceDeclaration/fixtures/extends-one/fixture.ts", + "declaration/TSInterfaceDeclaration/fixtures/type-param-many/fixture.ts", + "declaration/TSInterfaceDeclaration/fixtures/type-param-one/fixture.ts", + "declaration/TSInterfaceDeclaration/fixtures/with-member-one/fixture.ts", + "declaration/VariableDeclaration/fixtures/declare/fixture.ts", + "declaration/VariableDeclaration/fixtures/let-with-value/fixture.ts", + "declaration/VariableDeclaration/fixtures/let-without-value/fixture.ts", + "declaration/VariableDeclaration/fixtures/multiple-declarations/fixture.ts", } `; diff --git a/packages/eslint-plugin-internal/CHANGELOG.md b/packages/eslint-plugin-internal/CHANGELOG.md index 20ecffa98294..708dc230e7c0 100644 --- a/packages/eslint-plugin-internal/CHANGELOG.md +++ b/packages/eslint-plugin-internal/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal + + + + + # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-internal diff --git a/packages/eslint-plugin-internal/jest.config.js b/packages/eslint-plugin-internal/jest.config.js index 5f1ea3f4bcb0..910991b20cff 100644 --- a/packages/eslint-plugin-internal/jest.config.js +++ b/packages/eslint-plugin-internal/jest.config.js @@ -4,5 +4,4 @@ /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { ...require('../../jest.config.base.js'), - testRegex: './tests/.+\\.test\\.ts$', }; diff --git a/packages/eslint-plugin-internal/package.json b/packages/eslint-plugin-internal/package.json index 1329c7b60cdc..9bbcb633b100 100644 --- a/packages/eslint-plugin-internal/package.json +++ b/packages/eslint-plugin-internal/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-internal", - "version": "5.25.0", + "version": "5.26.0", "private": true, "main": "dist/index.js", "scripts": { @@ -14,8 +14,8 @@ }, "dependencies": { "@types/prettier": "*", - "@typescript-eslint/scope-manager": "5.25.0", - "@typescript-eslint/utils": "5.25.0", + "@typescript-eslint/scope-manager": "5.26.0", + "@typescript-eslint/utils": "5.26.0", "prettier": "*" } } diff --git a/packages/eslint-plugin-tslint/CHANGELOG.md b/packages/eslint-plugin-tslint/CHANGELOG.md index 7d01d518b2fa..b03e61eb79b1 100644 --- a/packages/eslint-plugin-tslint/CHANGELOG.md +++ b/packages/eslint-plugin-tslint/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) + +**Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint + + + + + # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) **Note:** Version bump only for package @typescript-eslint/eslint-plugin-tslint diff --git a/packages/eslint-plugin-tslint/jest.config.js b/packages/eslint-plugin-tslint/jest.config.js index 821770114b26..910991b20cff 100644 --- a/packages/eslint-plugin-tslint/jest.config.js +++ b/packages/eslint-plugin-tslint/jest.config.js @@ -4,5 +4,4 @@ /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { ...require('../../jest.config.base.js'), - testRegex: './tests/.+\\.spec\\.ts$', }; diff --git a/packages/eslint-plugin-tslint/package.json b/packages/eslint-plugin-tslint/package.json index 77ebaade61ee..710adf382ea6 100644 --- a/packages/eslint-plugin-tslint/package.json +++ b/packages/eslint-plugin-tslint/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin-tslint", - "version": "5.25.0", + "version": "5.26.0", "main": "dist/index.js", "typings": "src/index.ts", "description": "TSLint wrapper plugin for ESLint", @@ -38,7 +38,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/utils": "5.25.0", + "@typescript-eslint/utils": "5.26.0", "lodash": "^4.17.21" }, "peerDependencies": { @@ -48,6 +48,6 @@ }, "devDependencies": { "@types/lodash": "*", - "@typescript-eslint/parser": "5.25.0" + "@typescript-eslint/parser": "5.26.0" } } diff --git a/packages/eslint-plugin/CHANGELOG.md b/packages/eslint-plugin/CHANGELOG.md index 8c4ca25501f0..9ff900c12d32 100644 --- a/packages/eslint-plugin/CHANGELOG.md +++ b/packages/eslint-plugin/CHANGELOG.md @@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) + + +### Bug Fixes + +* **eslint-plugin:** [member-delimiter-style] autofixer result is not as expected when comments after the delimiter with option `delimiter: 'none'` ([#5029](https://github.com/typescript-eslint/typescript-eslint/issues/5029)) ([ed7b5f6](https://github.com/typescript-eslint/typescript-eslint/commit/ed7b5f61d93799fec3e38a87935ab9caa3abe279)) +* **eslint-plugin:** [member-delimiter-style] autofixer result is not as expected with option `delimiter: 'none'` ([#5023](https://github.com/typescript-eslint/typescript-eslint/issues/5023)) ([9e97a11](https://github.com/typescript-eslint/typescript-eslint/commit/9e97a11ecd80be5c63c980bfe8d8e57400221cec)) +* **eslint-plugin:** [prefer-readonly] correct issue with anonymus functions ([#4974](https://github.com/typescript-eslint/typescript-eslint/issues/4974)) ([952e2f0](https://github.com/typescript-eslint/typescript-eslint/commit/952e2f068862dde089ec03d3eb5452d1ee3e9271)), closes [#2590](https://github.com/typescript-eslint/typescript-eslint/issues/2590) + + + + + # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) diff --git a/packages/eslint-plugin/docs/rules/README.md b/packages/eslint-plugin/docs/rules/README.md index 94793a6fa011..0558f7195afd 100644 --- a/packages/eslint-plugin/docs/rules/README.md +++ b/packages/eslint-plugin/docs/rules/README.md @@ -39,7 +39,7 @@ See [Configs](/docs/linting/configs) for how to enable recommended rules using c | [`@typescript-eslint/no-base-to-string`](./no-base-to-string.md) | Requires that `.toString()` is only called on objects which provide useful information when stringified | :lock: | | :thought_balloon: | | [`@typescript-eslint/no-confusing-non-null-assertion`](./no-confusing-non-null-assertion.md) | Disallow non-null assertion in locations that may be confusing | :lock: | :wrench: | | | [`@typescript-eslint/no-confusing-void-expression`](./no-confusing-void-expression.md) | Requires expressions of type void to appear in statement position | | :wrench: | :thought_balloon: | -| [`@typescript-eslint/no-duplicate-enum-values`](./docs/rules/no-duplicate-enum-values.md) | Disallow duplicate enum member values | :lock: | | | +| [`@typescript-eslint/no-duplicate-enum-values`](./no-duplicate-enum-values.md) | Disallow duplicate enum member values | :lock: | | | | [`@typescript-eslint/no-dynamic-delete`](./no-dynamic-delete.md) | Disallow the delete operator with computed key expressions | :lock: | :wrench: | | | [`@typescript-eslint/no-empty-interface`](./no-empty-interface.md) | Disallow the declaration of empty interfaces | :white_check_mark: | :wrench: | | | [`@typescript-eslint/no-explicit-any`](./no-explicit-any.md) | Disallow usage of the `any` type | :white_check_mark: | :wrench: | | diff --git a/packages/eslint-plugin/docs/rules/ban-types.md b/packages/eslint-plugin/docs/rules/ban-types.md index b83186fe7476..3189c086a1cc 100644 --- a/packages/eslint-plugin/docs/rules/ban-types.md +++ b/packages/eslint-plugin/docs/rules/ban-types.md @@ -27,17 +27,27 @@ type Options = { }; ``` -The rule accepts a single object as options, with the following keys: - -- `types` - An object whose keys are the types you want to ban, and the values are error messages. - - The type can either be a type name literal (`Foo`), a type name with generic parameter instantiation(s) (`Foo`), the empty object literal (`{}`), or the empty tuple type (`[]`). - - The values can be a string, which is the error message to be reported, `false` to specifically disable this type - or it can be an object with the following properties: - - `message: string` - the message to display when the type is matched. - - `fixWith?: string` - a string to replace the banned type with when the fixer is run. If this is omitted, no fix will be done. -- `extendDefaults` - if you're specifying custom `types`, you can set this to `true` to extend the default `types` configuration. - - This is a convenience option to save you copying across the defaults when adding another type. - - If this is `false`, the rule will _only_ use the types defined in your configuration. +The rule accepts a single object as options. + +### `types` + +An object whose keys are the types you want to ban, and the values are error messages. + +The type can either be a type name literal (`Foo`), a type name with generic parameter instantiation(s) (`Foo`), the empty object literal (`{}`), or the empty tuple type (`[]`). + +The values can be: + +- A string, which is the error message to be reported; or +- `false` to specifically un-ban this type (useful when you are using `extendDefaults`); or +- An object with the following properties: + - `message: string` - the message to display when the type is matched. + - `fixWith?: string` - a string to replace the banned type with when the fixer is run. If this is omitted, no fix will be done. + +### `extendDefaults` + +If you're specifying custom `types`, you can set this to `true` to extend the default `types` configuration. This is a convenience option to save you copying across the defaults when adding another type. + +If this is `false`, the rule will _only_ use the types defined in your configuration. Example configuration: @@ -51,16 +61,15 @@ Example configuration: "Foo": "Don't use Foo because it is unsafe", // add a custom message, AND tell the plugin how to fix it - "String": { - "message": "Use string instead", - "fixWith": "string" + "OldAPI": { + "message": "Use NewAPI instead", + "fixWith": "NewAPI" }, - "{}": { - "message": "Use object instead", - "fixWith": "object" - } - } + // un-ban a type that's banned by default + "{}": false + }, + "extendsDefaults": true } ] } diff --git a/packages/eslint-plugin/docs/rules/triple-slash-reference.md b/packages/eslint-plugin/docs/rules/triple-slash-reference.md index 2488d28ab135..d15d1cc5e129 100644 --- a/packages/eslint-plugin/docs/rules/triple-slash-reference.md +++ b/packages/eslint-plugin/docs/rules/triple-slash-reference.md @@ -44,6 +44,22 @@ import * as foo from 'foo'; import foo = require('foo'); ``` +## Options + +```ts +type Options = { + lib?: 'always' | 'never'; + path?: 'always' | 'never'; + types?: 'always' | 'never' | 'prefer-import'; +}; + +const defaultOptions: Options = { + lib: 'always', + path: 'never', + types: 'prefer-import', +}; +``` + ## When To Use It If you want to ban use of one or all of the triple slash reference directives, or any time you might use triple-slash type reference directives and ES6 import declarations in the same file. diff --git a/packages/eslint-plugin/jest.config.js b/packages/eslint-plugin/jest.config.js index 1f9cdcdecd92..910991b20cff 100644 --- a/packages/eslint-plugin/jest.config.js +++ b/packages/eslint-plugin/jest.config.js @@ -4,6 +4,4 @@ /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { ...require('../../jest.config.base.js'), - testRegex: './tests/.+\\.test\\.ts$', - coverageReporters: ['text-summary', 'lcov'], }; diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 00acf3790485..9356f6b326f9 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/eslint-plugin", - "version": "5.25.0", + "version": "5.26.0", "description": "TypeScript plugin for ESLint", "keywords": [ "eslint", @@ -44,9 +44,9 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/scope-manager": "5.25.0", - "@typescript-eslint/type-utils": "5.25.0", - "@typescript-eslint/utils": "5.25.0", + "@typescript-eslint/scope-manager": "5.26.0", + "@typescript-eslint/type-utils": "5.26.0", + "@typescript-eslint/utils": "5.26.0", "debug": "^4.3.4", "functional-red-black-tree": "^1.0.1", "ignore": "^5.2.0", diff --git a/packages/eslint-plugin/src/rules/member-delimiter-style.ts b/packages/eslint-plugin/src/rules/member-delimiter-style.ts index e35b6459de8a..2919a2091f62 100644 --- a/packages/eslint-plugin/src/rules/member-delimiter-style.ts +++ b/packages/eslint-plugin/src/rules/member-delimiter-style.ts @@ -35,6 +35,7 @@ interface MakeFixFunctionParams { optsNone: boolean; optsSemi: boolean; lastToken: LastTokenType; + commentsAfterLastToken: LastTokenType | undefined; missingDelimiter: boolean; lastTokenLine: string; isSingleLine: boolean; @@ -68,16 +69,35 @@ const definition = { additionalProperties: false, }; -const isLastTokenEndOfLine = (token: string, line: string): boolean => { - const positionInLine = line.indexOf(token); +const isLastTokenEndOfLine = (token: LastTokenType, line: string): boolean => { + const positionInLine = token.loc.start.column; return positionInLine === line.length - 1; }; +const isCommentsEndOfLine = ( + token: LastTokenType, + comments: LastTokenType | undefined, + line: string, +): boolean => { + if (!comments) { + return false; + } + + if (comments.loc.end.line > token.loc.end.line) { + return true; + } + + const positionInLine = comments.loc.end.column; + + return positionInLine === line.length; +}; + const makeFixFunction = ({ optsNone, optsSemi, lastToken, + commentsAfterLastToken, missingDelimiter, lastTokenLine, isSingleLine, @@ -85,7 +105,8 @@ const makeFixFunction = ({ // if removing is the action but last token is not the end of the line if ( optsNone && - !isLastTokenEndOfLine(lastToken.value, lastTokenLine) && + !isLastTokenEndOfLine(lastToken, lastTokenLine) && + !isCommentsEndOfLine(lastToken, commentsAfterLastToken, lastTokenLine) && !isSingleLine ) { return null; @@ -206,6 +227,10 @@ export default util.createRule({ return; } + const commentsAfterLastToken = sourceCode + .getCommentsAfter(lastToken) + .pop(); + const sourceCodeLines = sourceCode.getLines(); const lastTokenLine = sourceCodeLines[lastToken?.loc.start.line - 1]; @@ -255,6 +280,7 @@ export default util.createRule({ optsNone, optsSemi, lastToken, + commentsAfterLastToken, missingDelimiter, lastTokenLine, isSingleLine: opts.type === 'single-line', diff --git a/packages/eslint-plugin/src/rules/prefer-readonly.ts b/packages/eslint-plugin/src/rules/prefer-readonly.ts index 19597264bbcb..816a79371fbe 100644 --- a/packages/eslint-plugin/src/rules/prefer-readonly.ts +++ b/packages/eslint-plugin/src/rules/prefer-readonly.ts @@ -270,8 +270,12 @@ class ClassScope { classNode: ts.ClassLikeDeclaration, private readonly onlyInlineLambdas?: boolean, ) { - this.checker = checker; - this.classType = checker.getTypeAtLocation(classNode); + const classType = checker.getTypeAtLocation(classNode); + if (tsutils.isIntersectionType(classType)) { + this.classType = classType.types[0]; + } else { + this.classType = classType; + } for (const member of classNode.members) { if (ts.isPropertyDeclaration(member)) { diff --git a/packages/eslint-plugin/tests/rules/member-delimiter-style.test.ts b/packages/eslint-plugin/tests/rules/member-delimiter-style.test.ts index fa75383df8e3..1b618448a93c 100644 --- a/packages/eslint-plugin/tests/rules/member-delimiter-style.test.ts +++ b/packages/eslint-plugin/tests/rules/member-delimiter-style.test.ts @@ -3548,5 +3548,79 @@ type Foo = {a: { }, ], }, + { + code: ` +type Foo = { + a: { + b: true; + }; c: false; +} + `, + output: ` +type Foo = { + a: { + b: true + }; c: false +} + `, + options: [ + { + multiline: { delimiter: 'none' }, + }, + ], + errors: [ + { + messageId: 'unexpectedSemi', + line: 4, + column: 13, + }, + { + messageId: 'unexpectedSemi', + line: 5, + column: 5, + }, + { + messageId: 'unexpectedSemi', + line: 5, + column: 15, + }, + ], + }, + { + code: ` +type Foo = { + a: true; /** something */ /** some + thing */ b: true; /** something */ c: false; // something +} + `, + output: ` +type Foo = { + a: true /** something */ /** some + thing */ b: true; /** something */ c: false // something +} + `, + options: [ + { + multiline: { delimiter: 'none' }, + }, + ], + errors: [ + { + messageId: 'unexpectedSemi', + line: 3, + column: 11, + }, + { + messageId: 'unexpectedSemi', + line: 4, + column: 20, + }, + { + messageId: 'unexpectedSemi', + line: 4, + column: 47, + }, + ], + }, ], }); diff --git a/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts b/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts index c1602f019134..91e8213da579 100644 --- a/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts +++ b/packages/eslint-plugin/tests/rules/prefer-readonly.test.ts @@ -292,6 +292,19 @@ class Foo { }, { code: ` +function ClassWithName {}>(Base: TBase) { + return class extends Base { + private _name: string; + + public test(value: string) { + this._name = value; + } + }; +} + `, + }, + { + code: ` class Foo { private value: Record = {}; @@ -704,5 +717,30 @@ class Foo { } `, }, + { + code: ` +function ClassWithName {}>(Base: TBase) { + return class extends Base { + private _name: string; + }; +} + `, + output: ` +function ClassWithName {}>(Base: TBase) { + return class extends Base { + private readonly _name: string; + }; +} + `, + errors: [ + { + data: { + name: '_name', + }, + line: 4, + messageId: 'preferReadonly', + }, + ], + }, ], }); diff --git a/packages/experimental-utils/CHANGELOG.md b/packages/experimental-utils/CHANGELOG.md index 486ed3097f71..feed203c699a 100644 --- a/packages/experimental-utils/CHANGELOG.md +++ b/packages/experimental-utils/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) + +**Note:** Version bump only for package @typescript-eslint/experimental-utils + + + + + # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) **Note:** Version bump only for package @typescript-eslint/experimental-utils diff --git a/packages/experimental-utils/package.json b/packages/experimental-utils/package.json index b8e1d9ec230f..beaad1f279d6 100644 --- a/packages/experimental-utils/package.json +++ b/packages/experimental-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/experimental-utils", - "version": "5.25.0", + "version": "5.26.0", "description": "(Experimental) Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -38,7 +38,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/utils": "5.25.0" + "@typescript-eslint/utils": "5.26.0" }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" diff --git a/packages/parser/CHANGELOG.md b/packages/parser/CHANGELOG.md index 2ff32ebf9f81..d832453d454b 100644 --- a/packages/parser/CHANGELOG.md +++ b/packages/parser/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) + +**Note:** Version bump only for package @typescript-eslint/parser + + + + + # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) **Note:** Version bump only for package @typescript-eslint/parser diff --git a/packages/parser/package.json b/packages/parser/package.json index 7b98529b475d..fcb40066bf43 100644 --- a/packages/parser/package.json +++ b/packages/parser/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/parser", - "version": "5.25.0", + "version": "5.26.0", "description": "An ESLint custom parser which leverages TypeScript ESTree", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -44,9 +44,9 @@ "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" }, "dependencies": { - "@typescript-eslint/scope-manager": "5.25.0", - "@typescript-eslint/types": "5.25.0", - "@typescript-eslint/typescript-estree": "5.25.0", + "@typescript-eslint/scope-manager": "5.26.0", + "@typescript-eslint/types": "5.26.0", + "@typescript-eslint/typescript-estree": "5.26.0", "debug": "^4.3.4" }, "devDependencies": { diff --git a/packages/scope-manager/CHANGELOG.md b/packages/scope-manager/CHANGELOG.md index 17df5044b7b5..96e2f4e18e49 100644 --- a/packages/scope-manager/CHANGELOG.md +++ b/packages/scope-manager/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) + +**Note:** Version bump only for package @typescript-eslint/scope-manager + + + + + # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) diff --git a/packages/scope-manager/jest.config.js b/packages/scope-manager/jest.config.js index ccaa4a6999bb..9148e4d46fb7 100644 --- a/packages/scope-manager/jest.config.js +++ b/packages/scope-manager/jest.config.js @@ -1,19 +1,8 @@ 'use strict'; // @ts-check - /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { - displayName: 'scope-manager', - preset: '../../jest.preset.js', - testEnvironment: 'node', - transform: { - '^.+\\.[tj]sx?$': [ - '@swc/jest', - { jsc: { transform: { react: { runtime: 'automatic' } } } }, - ], - }, - moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx'], - coverageDirectory: '/coverage', + ...require('../../jest.config.base.js'), setupFilesAfterEnv: ['./tests/util/serializers/index.ts'], }; diff --git a/packages/scope-manager/package.json b/packages/scope-manager/package.json index 90e900573251..e45e825f30a0 100644 --- a/packages/scope-manager/package.json +++ b/packages/scope-manager/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/scope-manager", - "version": "5.25.0", + "version": "5.26.0", "description": "TypeScript scope analyser for ESLint", "keywords": [ "eslint", @@ -38,12 +38,12 @@ "typecheck": "cd ../../ && nx typecheck @typescript-eslint/scope-manager" }, "dependencies": { - "@typescript-eslint/types": "5.25.0", - "@typescript-eslint/visitor-keys": "5.25.0" + "@typescript-eslint/types": "5.26.0", + "@typescript-eslint/visitor-keys": "5.26.0" }, "devDependencies": { "@types/glob": "*", - "@typescript-eslint/typescript-estree": "5.25.0", + "@typescript-eslint/typescript-estree": "5.26.0", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", diff --git a/packages/shared-fixtures/CHANGELOG.md b/packages/shared-fixtures/CHANGELOG.md index 1588386a06b5..2b4c428a0599 100644 --- a/packages/shared-fixtures/CHANGELOG.md +++ b/packages/shared-fixtures/CHANGELOG.md @@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) + + +### Features + +* [4.7] support instantiation expressions ([#4938](https://github.com/typescript-eslint/typescript-eslint/issues/4938)) ([79fbc77](https://github.com/typescript-eslint/typescript-eslint/commit/79fbc7743ae5dce3190f8168776e0204755390ad)) +* [4.7] support optional variance annotation ([#4831](https://github.com/typescript-eslint/typescript-eslint/issues/4831)) ([7e7b24c](https://github.com/typescript-eslint/typescript-eslint/commit/7e7b24c196e6d968e48f97f46feae5e7027e22d2)) +* **typescript-estree:** `extends` constraints for `infer` ([#4830](https://github.com/typescript-eslint/typescript-eslint/issues/4830)) ([8cbbcc3](https://github.com/typescript-eslint/typescript-eslint/commit/8cbbcc3d317779e0dcba15d3835137f38383de34)) + + + + + # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) **Note:** Version bump only for package @typescript-eslint/shared-fixtures diff --git a/packages/shared-fixtures/fixtures/typescript/expressions/instantiation-expression.src.ts b/packages/shared-fixtures/fixtures/typescript/expressions/instantiation-expression.src.ts new file mode 100644 index 000000000000..6f756d66ee63 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/expressions/instantiation-expression.src.ts @@ -0,0 +1,7 @@ +a; + +(a); +(a)(); +(a)?.(); +(a?.b)(); +new (a)(); diff --git a/packages/shared-fixtures/fixtures/typescript/types/conditional-infer-with-constraint.src.ts b/packages/shared-fixtures/fixtures/typescript/types/conditional-infer-with-constraint.src.ts new file mode 100644 index 000000000000..36ce0699bb65 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/types/conditional-infer-with-constraint.src.ts @@ -0,0 +1,5 @@ +type X3 = T extends [infer U extends number] ? MustBeNumber : never; +type X4 = T extends [infer U extends number, infer U extends number] ? MustBeNumber : never; +type X5 = T extends [infer U extends number, infer U] ? MustBeNumber : never; +type X6 = T extends [infer U, infer U extends number] ? MustBeNumber : never; +type X7 = T extends [infer U extends string, infer U extends number] ? U : never; diff --git a/packages/shared-fixtures/fixtures/typescript/types/optional-variance-in-and-out.src.ts b/packages/shared-fixtures/fixtures/typescript/types/optional-variance-in-and-out.src.ts new file mode 100644 index 000000000000..ee58a11cfc37 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/types/optional-variance-in-and-out.src.ts @@ -0,0 +1 @@ +type Mapper = (x: T) => U; diff --git a/packages/shared-fixtures/fixtures/typescript/types/optional-variance-in-out.src.ts b/packages/shared-fixtures/fixtures/typescript/types/optional-variance-in-out.src.ts new file mode 100644 index 000000000000..1dd6ace1261d --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/types/optional-variance-in-out.src.ts @@ -0,0 +1 @@ +type Processor = (x: T) => T; diff --git a/packages/shared-fixtures/fixtures/typescript/types/optional-variance-in.src.ts b/packages/shared-fixtures/fixtures/typescript/types/optional-variance-in.src.ts new file mode 100644 index 000000000000..3cb911e9c26b --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/types/optional-variance-in.src.ts @@ -0,0 +1 @@ +type Consumer = (x: T) => void; diff --git a/packages/shared-fixtures/fixtures/typescript/types/optional-variance-out.src.ts b/packages/shared-fixtures/fixtures/typescript/types/optional-variance-out.src.ts new file mode 100644 index 000000000000..dd9dd2012492 --- /dev/null +++ b/packages/shared-fixtures/fixtures/typescript/types/optional-variance-out.src.ts @@ -0,0 +1 @@ +type Provider = () => T; diff --git a/packages/shared-fixtures/package.json b/packages/shared-fixtures/package.json index 3f666f5b95df..d566b750d8a3 100644 --- a/packages/shared-fixtures/package.json +++ b/packages/shared-fixtures/package.json @@ -1,5 +1,5 @@ { "name": "@typescript-eslint/shared-fixtures", - "version": "5.25.0", + "version": "5.26.0", "private": true } diff --git a/packages/type-utils/CHANGELOG.md b/packages/type-utils/CHANGELOG.md index 03410ee17565..a223df579620 100644 --- a/packages/type-utils/CHANGELOG.md +++ b/packages/type-utils/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) + +**Note:** Version bump only for package @typescript-eslint/type-utils + + + + + # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) **Note:** Version bump only for package @typescript-eslint/type-utils diff --git a/packages/type-utils/jest.config.js b/packages/type-utils/jest.config.js index 5f1ea3f4bcb0..910991b20cff 100644 --- a/packages/type-utils/jest.config.js +++ b/packages/type-utils/jest.config.js @@ -4,5 +4,4 @@ /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { ...require('../../jest.config.base.js'), - testRegex: './tests/.+\\.test\\.ts$', }; diff --git a/packages/type-utils/package.json b/packages/type-utils/package.json index c13af3b74489..bd660ad19901 100644 --- a/packages/type-utils/package.json +++ b/packages/type-utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/type-utils", - "version": "5.25.0", + "version": "5.26.0", "description": "Type utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -39,12 +39,12 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/utils": "5.25.0", + "@typescript-eslint/utils": "5.26.0", "debug": "^4.3.4", "tsutils": "^3.21.0" }, "devDependencies": { - "@typescript-eslint/parser": "5.25.0", + "@typescript-eslint/parser": "5.26.0", "typescript": "*" }, "peerDependencies": { diff --git a/packages/types/CHANGELOG.md b/packages/types/CHANGELOG.md index 7cd2e90b53e4..b8a99c2555ed 100644 --- a/packages/types/CHANGELOG.md +++ b/packages/types/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) + +**Note:** Version bump only for package @typescript-eslint/types + + + + + # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) diff --git a/packages/types/jest.config.js b/packages/types/jest.config.js index 77fe4d022a95..910991b20cff 100644 --- a/packages/types/jest.config.js +++ b/packages/types/jest.config.js @@ -4,5 +4,4 @@ /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { ...require('../../jest.config.base.js'), - testRegex: ['./tests/.+\\.test\\.ts$'], }; diff --git a/packages/types/package.json b/packages/types/package.json index 2d25da527d1b..e1b20f66ede5 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/types", - "version": "5.25.0", + "version": "5.26.0", "description": "Types for the TypeScript-ESTree AST spec", "keywords": [ "eslint", diff --git a/packages/typescript-estree/CHANGELOG.md b/packages/typescript-estree/CHANGELOG.md index 7508249a5842..b1bd82a8d33d 100644 --- a/packages/typescript-estree/CHANGELOG.md +++ b/packages/typescript-estree/CHANGELOG.md @@ -3,6 +3,19 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) + + +### Features + +* [4.7] support instantiation expressions ([#4938](https://github.com/typescript-eslint/typescript-eslint/issues/4938)) ([79fbc77](https://github.com/typescript-eslint/typescript-eslint/commit/79fbc7743ae5dce3190f8168776e0204755390ad)) +* [4.7] support optional variance annotation ([#4831](https://github.com/typescript-eslint/typescript-eslint/issues/4831)) ([7e7b24c](https://github.com/typescript-eslint/typescript-eslint/commit/7e7b24c196e6d968e48f97f46feae5e7027e22d2)) +* **typescript-estree:** `extends` constraints for `infer` ([#4830](https://github.com/typescript-eslint/typescript-eslint/issues/4830)) ([8cbbcc3](https://github.com/typescript-eslint/typescript-eslint/commit/8cbbcc3d317779e0dcba15d3835137f38383de34)) + + + + + # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) diff --git a/packages/typescript-estree/package.json b/packages/typescript-estree/package.json index fd905d2fb2f0..24366e8f398f 100644 --- a/packages/typescript-estree/package.json +++ b/packages/typescript-estree/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/typescript-estree", - "version": "5.25.0", + "version": "5.26.0", "description": "A parser that converts TypeScript source code into an ESTree compatible form", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -41,8 +41,8 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "5.25.0", - "@typescript-eslint/visitor-keys": "5.25.0", + "@typescript-eslint/types": "5.26.0", + "@typescript-eslint/visitor-keys": "5.26.0", "debug": "^4.3.4", "globby": "^11.1.0", "is-glob": "^4.0.3", @@ -58,7 +58,7 @@ "@types/is-glob": "*", "@types/semver": "*", "@types/tmp": "*", - "@typescript-eslint/shared-fixtures": "5.25.0", + "@typescript-eslint/shared-fixtures": "5.26.0", "glob": "*", "jest-specific-snapshot": "*", "make-dir": "*", diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index f619a78d5bdc..9e5764296903 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -142,7 +142,11 @@ export class Converter { * @param result result * @returns the ESTreeNode with fixed exports */ - private fixExports( + private fixExports< + T extends + | TSESTree.DefaultExportDeclarations + | TSESTree.NamedExportDeclarations, + >( node: | ts.FunctionDeclaration | ts.VariableStatement @@ -184,9 +188,10 @@ export class Converter { const isType = result.type === AST_NODE_TYPES.TSInterfaceDeclaration || result.type === AST_NODE_TYPES.TSTypeAliasDeclaration; - const isDeclare = result.declare === true; + const isDeclare = 'declare' in result && result.declare === true; return this.createNode(node, { type: AST_NODE_TYPES.ExportNamedDeclaration, + // @ts-expect-error - TODO, narrow the types here declaration: result, specifiers: [], source: null, @@ -745,10 +750,19 @@ export class Converter { private assertModuleSpecifier( node: ts.ExportDeclaration | ts.ImportDeclaration, + allowNull: boolean, ): void { + if (!allowNull && node.moduleSpecifier == null) { + throw createError( + this.ast, + node.pos, + 'Module specifier must be a string literal.', + ); + } + if ( node.moduleSpecifier && - node.moduleSpecifier.kind !== SyntaxKind.StringLiteral + node.moduleSpecifier?.kind !== SyntaxKind.StringLiteral ) { throw createError( this.ast, @@ -964,10 +978,6 @@ export class Converter { result.returnType = this.convertTypeAnnotation(node.type, node); } - if (isDeclare) { - result.declare = true; - } - // Process typeParameters if (node.typeParameters) { result.typeParameters = @@ -976,6 +986,10 @@ export class Converter { ); } + if (isDeclare) { + result.declare = true; + } + // check for exports return this.fixExports(node, result); } @@ -1737,7 +1751,7 @@ export class Converter { }); case SyntaxKind.ImportDeclaration: { - this.assertModuleSpecifier(node); + this.assertModuleSpecifier(node, false); const result = this.createNode(node, { type: AST_NODE_TYPES.ImportDeclaration, @@ -1804,8 +1818,8 @@ export class Converter { } case SyntaxKind.ExportDeclaration: { - this.assertModuleSpecifier(node); if (node.exportClause?.kind === SyntaxKind.NamedExports) { + this.assertModuleSpecifier(node, true); return this.createNode(node, { type: AST_NODE_TYPES.ExportNamedDeclaration, source: this.convertChild(node.moduleSpecifier), @@ -1817,6 +1831,7 @@ export class Converter { assertions: this.convertAssertClasue(node.assertClause), }); } else { + this.assertModuleSpecifier(node, false); return this.createNode(node, { type: AST_NODE_TYPES.ExportAllDeclaration, source: this.convertChild(node.moduleSpecifier), @@ -2342,6 +2357,8 @@ export class Converter { ? this.convertType(node.constraint) : undefined, default: node.default ? this.convertType(node.default) : undefined, + in: hasModifier(SyntaxKind.InKeyword, node), + out: hasModifier(SyntaxKind.OutKeyword, node), }); } @@ -2574,13 +2591,19 @@ export class Converter { } case SyntaxKind.ExpressionWithTypeArguments: { + const parentKind = parent.kind; + const type = + parentKind === SyntaxKind.InterfaceDeclaration + ? AST_NODE_TYPES.TSInterfaceHeritage + : parentKind === SyntaxKind.HeritageClause + ? AST_NODE_TYPES.TSClassImplements + : AST_NODE_TYPES.TSInstantiationExpression; const result = this.createNode< - TSESTree.TSInterfaceHeritage | TSESTree.TSClassImplements + | TSESTree.TSInterfaceHeritage + | TSESTree.TSClassImplements + | TSESTree.TSInstantiationExpression >(node, { - type: - parent && parent.kind === SyntaxKind.InterfaceDeclaration - ? AST_NODE_TYPES.TSInterfaceHeritage - : AST_NODE_TYPES.TSClassImplements, + type, expression: this.convertChild(node.expression), }); diff --git a/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts b/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts index 0398d1991c20..666909b5a714 100644 --- a/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts +++ b/packages/typescript-estree/src/ts-estree/estree-to-ts-node-types.ts @@ -180,6 +180,7 @@ export interface EstreeToTsNodeTypes { [AST_NODE_TYPES.TSInterfaceBody]: ts.InterfaceDeclaration; [AST_NODE_TYPES.TSInterfaceHeritage]: ts.ExpressionWithTypeArguments; [AST_NODE_TYPES.TSIntersectionType]: ts.IntersectionTypeNode; + [AST_NODE_TYPES.TSInstantiationExpression]: ts.ExpressionWithTypeArguments; [AST_NODE_TYPES.TSLiteralType]: ts.LiteralTypeNode; [AST_NODE_TYPES.TSMappedType]: ts.MappedTypeNode; [AST_NODE_TYPES.TSMethodSignature]: diff --git a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts index 5f44161557cf..50981c203633 100644 --- a/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts +++ b/packages/typescript-estree/tests/ast-alignment/fixtures-to-test.ts @@ -453,6 +453,13 @@ tester.addFixturePatternConfig('typescript/decorators/property-decorators', { tester.addFixturePatternConfig('typescript/expressions', { fileType: 'ts', + ignore: [ + /** + * [BABEL ERRORED, BUT TS-ESTREE DID NOT] + * Babel doesn't support TS 4.7 new features yet. + */ + 'instantiation-expression', + ], }); tester.addFixturePatternConfig('typescript/errorRecovery', { @@ -484,6 +491,19 @@ tester.addFixturePatternConfig('typescript/types', { 'template-literal-type-2', 'template-literal-type-3', 'template-literal-type-4', + /** + * [BABEL ERRORED, BUT TS-ESTREE DID NOT] + * Babel doesn't support TS 4.7 new feature yet. + */ + 'conditional-infer-with-constraint', + /** + * [BABEL ERRORED, BUT TS-ESTREE DID NOT] + * Babel doesn't support TS 4.7 new features yet. + */ + 'optional-variance-in', + 'optional-variance-out', + 'optional-variance-in-out', + 'optional-variance-in-and-out', ], }); diff --git a/packages/typescript-estree/tests/ast-alignment/utils.ts b/packages/typescript-estree/tests/ast-alignment/utils.ts index ece4ab9e5112..01283b2a3f01 100644 --- a/packages/typescript-estree/tests/ast-alignment/utils.ts +++ b/packages/typescript-estree/tests/ast-alignment/utils.ts @@ -150,6 +150,13 @@ export function preprocessBabylonAST(ast: File): any { type: AST_NODE_TYPES.Identifier, }; } + // Babel does not support TS 4.7 optional variance yet. + if (!node.in) { + node.in = false; + } + if (!node.out) { + node.out = false; + } }, MethodDefinition(node) { /** diff --git a/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap index 0ea5f89cdcdb..0f40740978e1 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/convert.test.ts.snap @@ -475,6 +475,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 11, @@ -503,6 +504,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 10, 11, diff --git a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap index 03f030ad731e..12e8316d7b6f 100644 --- a/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap +++ b/packages/typescript-estree/tests/lib/__snapshots__/semantic-diagnostics-enabled.test.ts.snap @@ -2640,6 +2640,8 @@ TSError { exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/expressions/call-expression-type-arguments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/expressions/instantiation-expression.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/expressions/new-expression-type-arguments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/expressions/optional-call-expression-type-arguments.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -2668,6 +2670,8 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/conditional-infer-simple.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/conditional-infer-with-constraint.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/conditional-with-null.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/constructor.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; @@ -2730,6 +2734,14 @@ exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" e exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/object-literal-type-with-accessors.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/optional-variance-in.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/optional-variance-in-and-out.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/optional-variance-in-out.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + +exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/optional-variance-out.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; + exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/parenthesized-type.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; exports[`Parse all fixtures with "errorOnTypeScriptSyntacticAndSemanticIssues" enabled fixtures/typescript/types/reference.src 1`] = `"TEST OUTPUT: No semantic or syntactic issues found"`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/babylon-convergence/type-parameter-whitespace-loc.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/babylon-convergence/type-parameter-whitespace-loc.src.ts.shot index 84a0faacccaf..a32b6821f9e6 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/babylon-convergence/type-parameter-whitespace-loc.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/babylon-convergence/type-parameter-whitespace-loc.src.ts.shot @@ -74,6 +74,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 14, @@ -102,6 +103,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 13, 14, diff --git a/packages/typescript-estree/tests/snapshots/typescript/babylon-convergence/type-parameters.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/babylon-convergence/type-parameters.src.ts.shot index 245b52dc08a6..bd4752cee3b3 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/babylon-convergence/type-parameters.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/babylon-convergence/type-parameters.src.ts.shot @@ -106,6 +106,7 @@ Object { ], "type": "TSObjectKeyword", }, + "in": false, "loc": Object { "end": Object { "column": 36, @@ -134,6 +135,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 11, 36, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/arrow-function-with-type-parameters.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/arrow-function-with-type-parameters.src.ts.shot index 126d82a31154..b233dae579ec 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/arrow-function-with-type-parameters.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/arrow-function-with-type-parameters.src.ts.shot @@ -219,6 +219,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 2, @@ -247,6 +248,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 1, 2, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/call-signatures-with-generics.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/call-signatures-with-generics.src.ts.shot index 84bc3e241e60..8ec8827246f1 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/call-signatures-with-generics.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/call-signatures-with-generics.src.ts.shot @@ -168,6 +168,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 4, @@ -196,6 +197,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 16, 17, @@ -329,6 +331,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 7, @@ -357,6 +360,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 44, 45, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-type-parameters.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-type-parameters.src.ts.shot index 56353693fd68..fc9e41e1cce8 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-type-parameters.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-constructor-and-type-parameters.src.ts.shot @@ -98,6 +98,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 15, @@ -126,6 +127,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 24, 25, @@ -234,6 +236,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 19, @@ -262,6 +265,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 52, 53, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-extends-generic-multiple.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-extends-generic-multiple.src.ts.shot index bc3a09258d02..4b1632815042 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-extends-generic-multiple.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-extends-generic-multiple.src.ts.shot @@ -214,6 +214,7 @@ Object { "typeParameters": undefined, }, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 21, @@ -242,6 +243,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 10, 21, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-extends-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-extends-generic.src.ts.shot index fac393614970..1b34e17f7ebc 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-extends-generic.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-extends-generic.src.ts.shot @@ -143,6 +143,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 11, @@ -171,6 +172,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 10, 11, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-generic-method-default.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-generic-method-default.src.ts.shot index 517d5dd3e62a..d648e1c98cf4 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-generic-method-default.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-generic-method-default.src.ts.shot @@ -133,6 +133,7 @@ Object { }, "typeParameters": undefined, }, + "in": false, "loc": Object { "end": Object { "column": 16, @@ -161,6 +162,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 21, 28, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-generic-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-generic-method.src.ts.shot index 504612e7858d..f00ade847e86 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-generic-method.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-generic-method.src.ts.shot @@ -98,6 +98,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 10, @@ -126,6 +127,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 21, 22, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-method.src.ts.shot index 84f1c8825bcb..7519442ea6e9 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-method.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-method.src.ts.shot @@ -211,6 +211,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 7, @@ -239,6 +240,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 36, 37, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-mixin-reference.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-mixin-reference.src.ts.shot index e9b4d70e8378..47dd1de2f0d9 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-mixin-reference.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-mixin-reference.src.ts.shot @@ -235,6 +235,7 @@ Object { }, }, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 35, @@ -263,6 +264,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 11, 35, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-mixin.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-mixin.src.ts.shot index 7ea53067001e..8a9917336111 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-mixin.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-mixin.src.ts.shot @@ -289,6 +289,7 @@ Object { }, }, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 36, @@ -317,6 +318,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 11, 36, @@ -828,6 +830,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 18, @@ -856,6 +859,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 175, 176, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-two-methods-computed-constructor.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-two-methods-computed-constructor.src.ts.shot index abf1f5816b2e..f119f99cc7c6 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-two-methods-computed-constructor.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-two-methods-computed-constructor.src.ts.shot @@ -133,6 +133,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 17, @@ -161,6 +162,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 26, 27, @@ -303,6 +305,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 19, @@ -331,6 +334,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 64, 65, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-type-parameter-default.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-type-parameter-default.src.ts.shot index 7f1f690528fa..b062afebf385 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-type-parameter-default.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-type-parameter-default.src.ts.shot @@ -106,6 +106,7 @@ Object { }, "typeParameters": undefined, }, + "in": false, "loc": Object { "end": Object { "column": 17, @@ -134,6 +135,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 10, 17, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-type-parameter-underscore.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-type-parameter-underscore.src.ts.shot index d069b3552b37..f11826fd1047 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-type-parameter-underscore.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-type-parameter-underscore.src.ts.shot @@ -71,6 +71,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 11, @@ -99,6 +100,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 8, 11, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-type-parameter.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-type-parameter.src.ts.shot index 3e52dcb8d33f..8403e95ce8cb 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-type-parameter.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/class-with-type-parameter.src.ts.shot @@ -71,6 +71,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 11, @@ -99,6 +100,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 10, 11, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-default-class-with-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-default-class-with-generic.src.ts.shot index b2054c9f8be7..b8c81c94fc25 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/export-default-class-with-generic.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-default-class-with-generic.src.ts.shot @@ -55,6 +55,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 22, @@ -83,6 +84,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 21, 22, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-default-class-with-multiple-generics.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-default-class-with-multiple-generics.src.ts.shot index ad9d453a4915..5c8f0f1bd137 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/export-default-class-with-multiple-generics.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-default-class-with-multiple-generics.src.ts.shot @@ -55,6 +55,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 22, @@ -83,6 +84,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 21, 22, @@ -92,6 +94,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 25, @@ -120,6 +123,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 24, 25, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-class-with-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-class-with-generic.src.ts.shot index 4a6484753839..150f857526dd 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-class-with-generic.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-class-with-generic.src.ts.shot @@ -73,6 +73,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 18, @@ -101,6 +102,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 17, 18, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-class-with-multiple-generics.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-class-with-multiple-generics.src.ts.shot index 988daf8a174e..74f2566093d5 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-class-with-multiple-generics.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/export-named-class-with-multiple-generics.src.ts.shot @@ -73,6 +73,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 18, @@ -101,6 +102,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 17, 18, @@ -110,6 +112,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 21, @@ -138,6 +141,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 20, 21, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-anonymus-with-type-parameters.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-anonymus-with-type-parameters.src.ts.shot index 018d4d725523..9945853dea09 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/function-anonymus-with-type-parameters.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-anonymus-with-type-parameters.src.ts.shot @@ -167,6 +167,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 21, @@ -195,6 +196,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 20, 21, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-type-parameters-that-have-comments.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-type-parameters-that-have-comments.src.ts.shot index b626f8aa8037..0bd43c2697c4 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-type-parameters-that-have-comments.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-type-parameters-that-have-comments.src.ts.shot @@ -74,6 +74,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 29, @@ -102,6 +103,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 28, 29, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-type-parameters-with-constraint.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-type-parameters-with-constraint.src.ts.shot index a3ae99a13775..114fd02b9e62 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-type-parameters-with-constraint.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-type-parameters-with-constraint.src.ts.shot @@ -252,6 +252,7 @@ Object { "type": "TSTypeLiteral", }, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 23, @@ -280,6 +281,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 11, 23, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-type-parameters.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-type-parameters.src.ts.shot index d65c9203b652..defa0485d9e3 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-type-parameters.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/function-with-type-parameters.src.ts.shot @@ -235,6 +235,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 12, @@ -263,6 +264,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 11, 12, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/instantiation-expression.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/instantiation-expression.src.ts.shot new file mode 100644 index 000000000000..92bc144ccc0f --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/instantiation-expression.src.ts.shot @@ -0,0 +1,2330 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript basics instantiation-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 1, + 4, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "expression": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "name": "a", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 8, + 12, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "name": "b", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 9, + 12, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 7, + 16, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "name": "c", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 13, + 16, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 7, + 17, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "name": "a", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "name": "b", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 20, + 23, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 18, + 29, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "name": "c", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 24, + 27, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 18, + 30, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "expression": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "name": "a", + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 32, + 36, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "name": "b", + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 33, + 36, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 31, + 40, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "name": "c", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 37, + 40, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "optional": true, + "range": Array [ + 31, + 44, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 31, + 44, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 31, + 45, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "name": "a", + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "b", + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + }, + "range": Array [ + 47, + 51, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "range": Array [ + 47, + 51, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "range": Array [ + 47, + 54, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "name": "c", + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 51, + 54, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "optional": false, + "range": Array [ + 46, + 60, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "name": "d", + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 55, + 58, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 46, + 61, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "name": "a", + "range": Array [ + 67, + 68, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "range": Array [ + 67, + 71, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "name": "b", + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 68, + 71, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 62, + 77, + ], + "type": "NewExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "name": "c", + "range": Array [ + 73, + 74, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 72, + 75, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 62, + 78, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 79, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 40, + 42, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 48, + 50, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 62, + 65, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 7, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-type-parameters.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-type-parameters.src.ts.shot index 382d69ac3d40..f1d74ce8b70c 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-type-parameters.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-type-parameters.src.ts.shot @@ -70,6 +70,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 15, @@ -98,6 +99,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 14, 15, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-all-property-types.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-all-property-types.src.ts.shot index dece748c4b2d..8c772c7947a8 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-all-property-types.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-all-property-types.src.ts.shot @@ -880,6 +880,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 9, @@ -908,6 +909,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 194, 195, @@ -1116,6 +1118,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 10, @@ -1144,6 +1147,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 247, 248, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-extends-type-parameters.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-extends-type-parameters.src.ts.shot index 4cb2e5a2a089..5ac92facdff7 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-extends-type-parameters.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-extends-type-parameters.src.ts.shot @@ -162,6 +162,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 15, @@ -190,6 +191,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 14, 15, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-generic.src.ts.shot index 1ee99f876aaf..3c1d50e28b29 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-generic.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-generic.src.ts.shot @@ -70,6 +70,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 16, @@ -98,6 +99,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 15, 16, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-method.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-method.src.ts.shot index f94e34982985..fdc32c023359 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-method.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/interface-with-method.src.ts.shot @@ -308,6 +308,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 5, @@ -336,6 +337,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 45, 46, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/intrinsic-keyword.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/intrinsic-keyword.src.ts.shot index 22d41df5f1a2..5b885e496dfb 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/intrinsic-keyword.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/intrinsic-keyword.src.ts.shot @@ -85,6 +85,7 @@ Object { "type": "TSStringKeyword", }, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 31, @@ -113,6 +114,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 15, 31, @@ -209,6 +211,7 @@ Object { "type": "TSStringKeyword", }, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 31, @@ -237,6 +240,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 61, 77, @@ -333,6 +337,7 @@ Object { "type": "TSStringKeyword", }, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 32, @@ -361,6 +366,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 108, 124, @@ -457,6 +463,7 @@ Object { "type": "TSStringKeyword", }, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 34, @@ -485,6 +492,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 157, 173, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/object-with-typed-methods.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/object-with-typed-methods.src.ts.shot index 33dc823fd720..bafe11a59fd1 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/object-with-typed-methods.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/object-with-typed-methods.src.ts.shot @@ -200,6 +200,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 17, @@ -228,6 +229,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 30, 31, @@ -406,6 +408,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 7, @@ -434,6 +437,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 69, 70, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-with-constrained-type-parameter.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-with-constrained-type-parameter.src.ts.shot index 709a4cc36a64..d2c6248a377c 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-with-constrained-type-parameter.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration-with-constrained-type-parameter.src.ts.shot @@ -214,6 +214,7 @@ Object { "type": "TSTypeLiteral", }, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 24, @@ -242,6 +243,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 12, 24, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration.src.ts.shot index b97bf6d4afd6..169e2a2c6f63 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-alias-declaration.src.ts.shot @@ -197,6 +197,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 13, @@ -225,6 +226,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 12, 13, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-parameters-comments-heritage.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-parameters-comments-heritage.src.ts.shot index d244e9e147f8..9ac707ba48f9 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-parameters-comments-heritage.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-parameters-comments-heritage.src.ts.shot @@ -143,6 +143,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 23, @@ -171,6 +172,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 22, 23, @@ -360,6 +362,7 @@ Object { ], "type": "TSLiteralType", }, + "in": false, "loc": Object { "end": Object { "column": 38, @@ -388,6 +391,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 98, 113, @@ -561,6 +565,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 27, @@ -589,6 +594,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 191, 192, @@ -797,6 +803,7 @@ Object { ], "type": "TSLiteralType", }, + "in": false, "loc": Object { "end": Object { "column": 42, @@ -825,6 +832,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 272, 287, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/type-parameters-comments.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/type-parameters-comments.src.ts.shot index e4dc865f2b61..23e4e8cfe5c5 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/type-parameters-comments.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/type-parameters-comments.src.ts.shot @@ -183,6 +183,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 25, @@ -211,6 +212,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 68, 69, @@ -331,6 +333,7 @@ Object { }, "typeParameters": undefined, }, + "in": false, "loc": Object { "end": Object { "column": 41, @@ -359,6 +362,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 112, 129, diff --git a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-method-signature.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-method-signature.src.ts.shot index a175d632669d..45a7d8515871 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/basics/typed-method-signature.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/basics/typed-method-signature.src.ts.shot @@ -351,6 +351,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 5, @@ -379,6 +380,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 41, 42, diff --git a/packages/typescript-estree/tests/snapshots/typescript/expressions/instantiation-expression.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/expressions/instantiation-expression.src.ts.shot new file mode 100644 index 000000000000..25904ece493d --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/expressions/instantiation-expression.src.ts.shot @@ -0,0 +1,2330 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript expressions instantiation-expression.src 1`] = ` +Object { + "body": Array [ + Object { + "expression": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "name": "a", + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "name": "b", + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 1, + 4, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 5, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "expression": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "name": "a", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 8, + 12, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "name": "b", + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 9, + 12, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 7, + 16, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "name": "c", + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 13, + 16, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 7, + 17, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "name": "a", + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 19, + 23, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "name": "b", + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 20, + 23, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "optional": false, + "range": Array [ + 18, + 29, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "name": "c", + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 24, + 27, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 18, + 30, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "expression": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "name": "a", + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 32, + 36, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "name": "b", + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 33, + 36, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 31, + 40, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "name": "c", + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 37, + 40, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "optional": true, + "range": Array [ + 31, + 44, + ], + "type": "CallExpression", + }, + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 31, + 44, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 31, + 45, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "expression": Object { + "expression": Object { + "computed": false, + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "object": Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "name": "a", + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + }, + "optional": true, + "property": Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "name": "b", + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + }, + "range": Array [ + 47, + 51, + ], + "type": "MemberExpression", + }, + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "range": Array [ + 47, + 51, + ], + "type": "ChainExpression", + }, + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "range": Array [ + 47, + 54, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "name": "c", + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 51, + 54, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "optional": false, + "range": Array [ + 46, + 60, + ], + "type": "CallExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "name": "d", + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 55, + 58, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 46, + 61, + ], + "type": "ExpressionStatement", + }, + Object { + "expression": Object { + "arguments": Array [], + "callee": Object { + "expression": Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "name": "a", + "range": Array [ + 67, + 68, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "range": Array [ + 67, + 71, + ], + "type": "TSInstantiationExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "name": "b", + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 68, + 71, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 62, + 77, + ], + "type": "NewExpression", + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "name": "c", + "range": Array [ + 73, + 74, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 72, + 75, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 62, + 78, + ], + "type": "ExpressionStatement", + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 8, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 79, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 1, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 1, + }, + "start": Object { + "column": 1, + "line": 1, + }, + }, + "range": Array [ + 1, + 2, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 1, + }, + "start": Object { + "column": 2, + "line": 1, + }, + }, + "range": Array [ + 2, + 3, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 3, + "line": 1, + }, + }, + "range": Array [ + 3, + 4, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 1, + }, + "start": Object { + "column": 4, + "line": 1, + }, + }, + "range": Array [ + 4, + 5, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 3, + }, + "start": Object { + "column": 1, + "line": 3, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 3, + }, + "start": Object { + "column": 2, + "line": 3, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 3, + "line": 3, + }, + }, + "range": Array [ + 10, + 11, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 3, + }, + "start": Object { + "column": 4, + "line": 3, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 12, + 13, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 6, + "line": 3, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 4, + }, + "start": Object { + "column": 1, + "line": 4, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 4, + }, + "start": Object { + "column": 2, + "line": 4, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 3, + "line": 4, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 4, + }, + "start": Object { + "column": 4, + "line": 4, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 6, + "line": 4, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 4, + }, + "start": Object { + "column": 10, + "line": 4, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 5, + }, + "start": Object { + "column": 1, + "line": 5, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 5, + }, + "start": Object { + "column": 2, + "line": 5, + }, + }, + "range": Array [ + 33, + 34, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 3, + "line": 5, + }, + }, + "range": Array [ + 34, + 35, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 5, + }, + "start": Object { + "column": 4, + "line": 5, + }, + }, + "range": Array [ + 35, + 36, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 6, + "line": 5, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 39, + 40, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 40, + 42, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 42, + 43, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 5, + }, + "start": Object { + "column": 12, + "line": 5, + }, + }, + "range": Array [ + 43, + 44, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 44, + 45, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 1, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 6, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 2, + "line": 6, + }, + "start": Object { + "column": 1, + "line": 6, + }, + }, + "range": Array [ + 47, + 48, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 6, + }, + "start": Object { + "column": 2, + "line": 6, + }, + }, + "range": Array [ + 48, + 50, + ], + "type": "Punctuator", + "value": "?.", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 6, + }, + "start": Object { + "column": 4, + "line": 6, + }, + }, + "range": Array [ + 50, + 51, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 6, + }, + "start": Object { + "column": 5, + "line": 6, + }, + }, + "range": Array [ + 51, + 52, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 6, + }, + "start": Object { + "column": 6, + "line": 6, + }, + }, + "range": Array [ + 52, + 53, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 6, + }, + "start": Object { + "column": 7, + "line": 6, + }, + }, + "range": Array [ + 53, + 54, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 6, + }, + "start": Object { + "column": 8, + "line": 6, + }, + }, + "range": Array [ + 54, + 55, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 6, + }, + "start": Object { + "column": 9, + "line": 6, + }, + }, + "range": Array [ + 55, + 56, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 6, + }, + "start": Object { + "column": 10, + "line": 6, + }, + }, + "range": Array [ + 56, + 57, + ], + "type": "Identifier", + "value": "d", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 6, + }, + "start": Object { + "column": 11, + "line": 6, + }, + }, + "range": Array [ + 57, + 58, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 6, + }, + "start": Object { + "column": 12, + "line": 6, + }, + }, + "range": Array [ + 58, + 59, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 6, + }, + "start": Object { + "column": 13, + "line": 6, + }, + }, + "range": Array [ + 59, + 60, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 6, + }, + "start": Object { + "column": 14, + "line": 6, + }, + }, + "range": Array [ + 60, + 61, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 3, + "line": 7, + }, + "start": Object { + "column": 0, + "line": 7, + }, + }, + "range": Array [ + 62, + 65, + ], + "type": "Keyword", + "value": "new", + }, + Object { + "loc": Object { + "end": Object { + "column": 5, + "line": 7, + }, + "start": Object { + "column": 4, + "line": 7, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 6, + "line": 7, + }, + "start": Object { + "column": 5, + "line": 7, + }, + }, + "range": Array [ + 67, + 68, + ], + "type": "Identifier", + "value": "a", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 7, + }, + "start": Object { + "column": 6, + "line": 7, + }, + }, + "range": Array [ + 68, + 69, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 7, + }, + "start": Object { + "column": 7, + "line": 7, + }, + }, + "range": Array [ + 69, + 70, + ], + "type": "Identifier", + "value": "b", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 7, + }, + "start": Object { + "column": 8, + "line": 7, + }, + }, + "range": Array [ + 70, + 71, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 7, + }, + "start": Object { + "column": 9, + "line": 7, + }, + }, + "range": Array [ + 71, + 72, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 7, + }, + "start": Object { + "column": 10, + "line": 7, + }, + }, + "range": Array [ + 72, + 73, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 7, + }, + "start": Object { + "column": 11, + "line": 7, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Identifier", + "value": "c", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 7, + }, + "start": Object { + "column": 12, + "line": 7, + }, + }, + "range": Array [ + 74, + 75, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 7, + }, + "start": Object { + "column": 13, + "line": 7, + }, + }, + "range": Array [ + 75, + 76, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 7, + }, + "start": Object { + "column": 14, + "line": 7, + }, + }, + "range": Array [ + 76, + 77, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 7, + }, + "start": Object { + "column": 15, + "line": 7, + }, + }, + "range": Array [ + 77, + 78, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-nested.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-nested.src.ts.shot index 50f8f0f7ff82..693f5d114a98 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-nested.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-nested.src.ts.shot @@ -94,6 +94,7 @@ Object { "typeParameter": Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 20, @@ -122,6 +123,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 38, 39, @@ -201,6 +203,7 @@ Object { "typeParameter": Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 21, @@ -229,6 +232,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 69, 70, @@ -338,6 +342,7 @@ Object { "typeParameter": Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 31, @@ -366,6 +371,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 107, 108, @@ -588,6 +594,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 15, @@ -616,6 +623,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 14, 15, diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-simple.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-simple.src.ts.shot index c172c25e40ad..48cb6977cbf9 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-simple.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-simple.src.ts.shot @@ -161,6 +161,7 @@ Object { "typeParameter": Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 36, @@ -189,6 +190,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 35, 36, @@ -273,6 +275,7 @@ Object { "typeParameter": Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 48, @@ -301,6 +304,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 47, 48, @@ -401,6 +405,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 10, @@ -429,6 +434,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 9, 10, diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-with-constraint.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-with-constraint.src.ts.shot new file mode 100644 index 000000000000..f4a26f22e90a --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer-with-constraint.src.ts.shot @@ -0,0 +1,4163 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types conditional-infer-with-constraint.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "X3", + "range": Array [ + 5, + 7, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 74, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 74, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + "extendsType": Object { + "elementTypes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 46, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "TSNumberKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + }, + "out": false, + "range": Array [ + 30, + 46, + ], + "type": "TSTypeParameter", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 47, + ], + "type": "TSTupleType", + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 1, + }, + "start": Object { + "column": 68, + "line": 1, + }, + }, + "range": Array [ + 68, + 73, + ], + "type": "TSNeverKeyword", + }, + "loc": Object { + "end": Object { + "column": 73, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 73, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 1, + }, + "start": Object { + "column": 50, + "line": 1, + }, + }, + "range": Array [ + 50, + 65, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 62, + "line": 1, + }, + "start": Object { + "column": 50, + "line": 1, + }, + }, + "name": "MustBeNumber", + "range": Array [ + 50, + 62, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 63, + "line": 1, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 63, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 63, + 64, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 62, + 65, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "type": "TSConditionalType", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + }, + "out": false, + "range": Array [ + 8, + 9, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 7, + 10, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "name": "X4", + "range": Array [ + 80, + 82, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 98, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 75, + 173, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "name": "T", + "range": Array [ + 88, + 89, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + "extendsType": Object { + "elementTypes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 99, + 121, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 2, + }, + "start": Object { + "column": 40, + "line": 2, + }, + }, + "range": Array [ + 115, + 121, + ], + "type": "TSNumberKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 46, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "name": "U", + "range": Array [ + 105, + 106, + ], + "type": "Identifier", + }, + "out": false, + "range": Array [ + 105, + 121, + ], + "type": "TSTypeParameter", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 70, + "line": 2, + }, + "start": Object { + "column": 48, + "line": 2, + }, + }, + "range": Array [ + 123, + 145, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 70, + "line": 2, + }, + "start": Object { + "column": 64, + "line": 2, + }, + }, + "range": Array [ + 139, + 145, + ], + "type": "TSNumberKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 70, + "line": 2, + }, + "start": Object { + "column": 54, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 2, + }, + "start": Object { + "column": 54, + "line": 2, + }, + }, + "name": "U", + "range": Array [ + 129, + 130, + ], + "type": "Identifier", + }, + "out": false, + "range": Array [ + 129, + 145, + ], + "type": "TSTypeParameter", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 71, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 98, + 146, + ], + "type": "TSTupleType", + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 97, + "line": 2, + }, + "start": Object { + "column": 92, + "line": 2, + }, + }, + "range": Array [ + 167, + 172, + ], + "type": "TSNeverKeyword", + }, + "loc": Object { + "end": Object { + "column": 97, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 88, + 172, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 89, + "line": 2, + }, + "start": Object { + "column": 74, + "line": 2, + }, + }, + "range": Array [ + 149, + 164, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 86, + "line": 2, + }, + "start": Object { + "column": 74, + "line": 2, + }, + }, + "name": "MustBeNumber", + "range": Array [ + 149, + 161, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 89, + "line": 2, + }, + "start": Object { + "column": 86, + "line": 2, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 88, + "line": 2, + }, + "start": Object { + "column": 87, + "line": 2, + }, + }, + "range": Array [ + 162, + 163, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 88, + "line": 2, + }, + "start": Object { + "column": 87, + "line": 2, + }, + }, + "name": "U", + "range": Array [ + 162, + 163, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 161, + 164, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "type": "TSConditionalType", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "name": "T", + "range": Array [ + 83, + 84, + ], + "type": "Identifier", + }, + "out": false, + "range": Array [ + 83, + 84, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 82, + 85, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "name": "X5", + "range": Array [ + 179, + 181, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 83, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 174, + 257, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 187, + 188, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "name": "T", + "range": Array [ + 187, + 188, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + "extendsType": Object { + "elementTypes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 198, + 220, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 40, + "line": 3, + }, + }, + "range": Array [ + 214, + 220, + ], + "type": "TSNumberKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "name": "U", + "range": Array [ + 204, + 205, + ], + "type": "Identifier", + }, + "out": false, + "range": Array [ + 204, + 220, + ], + "type": "TSTypeParameter", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 3, + }, + "start": Object { + "column": 48, + "line": 3, + }, + }, + "range": Array [ + 222, + 229, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 55, + "line": 3, + }, + "start": Object { + "column": 54, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 3, + }, + "start": Object { + "column": 54, + "line": 3, + }, + }, + "name": "U", + "range": Array [ + 228, + 229, + ], + "type": "Identifier", + }, + "out": false, + "range": Array [ + 228, + 229, + ], + "type": "TSTypeParameter", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 56, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 197, + 230, + ], + "type": "TSTupleType", + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 82, + "line": 3, + }, + "start": Object { + "column": 77, + "line": 3, + }, + }, + "range": Array [ + 251, + 256, + ], + "type": "TSNeverKeyword", + }, + "loc": Object { + "end": Object { + "column": 82, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 187, + 256, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 3, + }, + "start": Object { + "column": 59, + "line": 3, + }, + }, + "range": Array [ + 233, + 248, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 3, + }, + "start": Object { + "column": 59, + "line": 3, + }, + }, + "name": "MustBeNumber", + "range": Array [ + 233, + 245, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 3, + }, + "start": Object { + "column": 71, + "line": 3, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 3, + }, + "start": Object { + "column": 72, + "line": 3, + }, + }, + "range": Array [ + 246, + 247, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 3, + }, + "start": Object { + "column": 72, + "line": 3, + }, + }, + "name": "U", + "range": Array [ + 246, + 247, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 245, + 248, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "type": "TSConditionalType", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "name": "T", + "range": Array [ + 182, + 183, + ], + "type": "Identifier", + }, + "out": false, + "range": Array [ + 182, + 183, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 181, + 184, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "name": "X6", + "range": Array [ + 263, + 265, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 83, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 258, + 341, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 271, + 272, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "name": "T", + "range": Array [ + 271, + 272, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + "extendsType": Object { + "elementTypes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 282, + 289, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "name": "U", + "range": Array [ + 288, + 289, + ], + "type": "Identifier", + }, + "out": false, + "range": Array [ + 288, + 289, + ], + "type": "TSTypeParameter", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 4, + }, + "start": Object { + "column": 33, + "line": 4, + }, + }, + "range": Array [ + 291, + 313, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 4, + }, + "start": Object { + "column": 49, + "line": 4, + }, + }, + "range": Array [ + 307, + 313, + ], + "type": "TSNumberKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 55, + "line": 4, + }, + "start": Object { + "column": 39, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 39, + "line": 4, + }, + }, + "name": "U", + "range": Array [ + 297, + 298, + ], + "type": "Identifier", + }, + "out": false, + "range": Array [ + 297, + 313, + ], + "type": "TSTypeParameter", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 56, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 281, + 314, + ], + "type": "TSTupleType", + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 82, + "line": 4, + }, + "start": Object { + "column": 77, + "line": 4, + }, + }, + "range": Array [ + 335, + 340, + ], + "type": "TSNeverKeyword", + }, + "loc": Object { + "end": Object { + "column": 82, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 271, + 340, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 4, + }, + "start": Object { + "column": 59, + "line": 4, + }, + }, + "range": Array [ + 317, + 332, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 4, + }, + "start": Object { + "column": 59, + "line": 4, + }, + }, + "name": "MustBeNumber", + "range": Array [ + 317, + 329, + ], + "type": "Identifier", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 4, + }, + "start": Object { + "column": 71, + "line": 4, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 4, + }, + "start": Object { + "column": 72, + "line": 4, + }, + }, + "range": Array [ + 330, + 331, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 4, + }, + "start": Object { + "column": 72, + "line": 4, + }, + }, + "name": "U", + "range": Array [ + 330, + 331, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + ], + "range": Array [ + 329, + 332, + ], + "type": "TSTypeParameterInstantiation", + }, + }, + "type": "TSConditionalType", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "name": "T", + "range": Array [ + 266, + 267, + ], + "type": "Identifier", + }, + "out": false, + "range": Array [ + 266, + 267, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 265, + 268, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "name": "X7", + "range": Array [ + 347, + 349, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 84, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 342, + 426, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "checkType": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 355, + 356, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "name": "T", + "range": Array [ + 355, + 356, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + "extendsType": Object { + "elementTypes": Array [ + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 24, + "line": 5, + }, + }, + "range": Array [ + 366, + 388, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 40, + "line": 5, + }, + }, + "range": Array [ + 382, + 388, + ], + "type": "TSStringKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "name": "U", + "range": Array [ + 372, + 373, + ], + "type": "Identifier", + }, + "out": false, + "range": Array [ + 372, + 388, + ], + "type": "TSTypeParameter", + }, + }, + Object { + "loc": Object { + "end": Object { + "column": 70, + "line": 5, + }, + "start": Object { + "column": 48, + "line": 5, + }, + }, + "range": Array [ + 390, + 412, + ], + "type": "TSInferType", + "typeParameter": Object { + "constraint": Object { + "loc": Object { + "end": Object { + "column": 70, + "line": 5, + }, + "start": Object { + "column": 64, + "line": 5, + }, + }, + "range": Array [ + 406, + 412, + ], + "type": "TSNumberKeyword", + }, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 70, + "line": 5, + }, + "start": Object { + "column": 54, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 54, + "line": 5, + }, + }, + "name": "U", + "range": Array [ + 396, + 397, + ], + "type": "Identifier", + }, + "out": false, + "range": Array [ + 396, + 412, + ], + "type": "TSTypeParameter", + }, + }, + ], + "loc": Object { + "end": Object { + "column": 71, + "line": 5, + }, + "start": Object { + "column": 23, + "line": 5, + }, + }, + "range": Array [ + 365, + 413, + ], + "type": "TSTupleType", + }, + "falseType": Object { + "loc": Object { + "end": Object { + "column": 83, + "line": 5, + }, + "start": Object { + "column": 78, + "line": 5, + }, + }, + "range": Array [ + 420, + 425, + ], + "type": "TSNeverKeyword", + }, + "loc": Object { + "end": Object { + "column": 83, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 355, + 425, + ], + "trueType": Object { + "loc": Object { + "end": Object { + "column": 75, + "line": 5, + }, + "start": Object { + "column": 74, + "line": 5, + }, + }, + "range": Array [ + 416, + 417, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 75, + "line": 5, + }, + "start": Object { + "column": 74, + "line": 5, + }, + }, + "name": "U", + "range": Array [ + 416, + 417, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + "type": "TSConditionalType", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "name": "T", + "range": Array [ + 350, + 351, + ], + "type": "Identifier", + }, + "out": false, + "range": Array [ + 350, + 351, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 349, + 352, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 6, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 427, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 7, + ], + "type": "Identifier", + "value": "X3", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 1, + }, + "start": Object { + "column": 7, + "line": 1, + }, + }, + "range": Array [ + 7, + 8, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 1, + }, + "start": Object { + "column": 8, + "line": 1, + }, + }, + "range": Array [ + 8, + 9, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 1, + }, + "start": Object { + "column": 9, + "line": 1, + }, + }, + "range": Array [ + 9, + 10, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 22, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 29, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 39, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 1, + }, + "start": Object { + "column": 40, + "line": 1, + }, + }, + "range": Array [ + 40, + 46, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 1, + }, + "start": Object { + "column": 46, + "line": 1, + }, + }, + "range": Array [ + 46, + 47, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 49, + "line": 1, + }, + "start": Object { + "column": 48, + "line": 1, + }, + }, + "range": Array [ + 48, + 49, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 62, + "line": 1, + }, + "start": Object { + "column": 50, + "line": 1, + }, + }, + "range": Array [ + 50, + 62, + ], + "type": "Identifier", + "value": "MustBeNumber", + }, + Object { + "loc": Object { + "end": Object { + "column": 63, + "line": 1, + }, + "start": Object { + "column": 62, + "line": 1, + }, + }, + "range": Array [ + 62, + 63, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 64, + "line": 1, + }, + "start": Object { + "column": 63, + "line": 1, + }, + }, + "range": Array [ + 63, + 64, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 65, + "line": 1, + }, + "start": Object { + "column": 64, + "line": 1, + }, + }, + "range": Array [ + 64, + 65, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 67, + "line": 1, + }, + "start": Object { + "column": 66, + "line": 1, + }, + }, + "range": Array [ + 66, + 67, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 1, + }, + "start": Object { + "column": 68, + "line": 1, + }, + }, + "range": Array [ + 68, + 73, + ], + "type": "Identifier", + "value": "never", + }, + Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 1, + }, + "start": Object { + "column": 73, + "line": 1, + }, + }, + "range": Array [ + 73, + 74, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 2, + }, + }, + "range": Array [ + 75, + 79, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 2, + }, + "start": Object { + "column": 5, + "line": 2, + }, + }, + "range": Array [ + 80, + 82, + ], + "type": "Identifier", + "value": "X4", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 2, + }, + "start": Object { + "column": 7, + "line": 2, + }, + }, + "range": Array [ + 82, + 83, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 2, + }, + "start": Object { + "column": 8, + "line": 2, + }, + }, + "range": Array [ + 83, + 84, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 2, + }, + "start": Object { + "column": 9, + "line": 2, + }, + }, + "range": Array [ + 84, + 85, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 2, + }, + "start": Object { + "column": 11, + "line": 2, + }, + }, + "range": Array [ + 86, + 87, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 2, + }, + "start": Object { + "column": 13, + "line": 2, + }, + }, + "range": Array [ + 88, + 89, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 2, + }, + "start": Object { + "column": 15, + "line": 2, + }, + }, + "range": Array [ + 90, + 97, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 2, + }, + "start": Object { + "column": 23, + "line": 2, + }, + }, + "range": Array [ + 98, + 99, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 2, + }, + "start": Object { + "column": 24, + "line": 2, + }, + }, + "range": Array [ + 99, + 104, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 2, + }, + "start": Object { + "column": 30, + "line": 2, + }, + }, + "range": Array [ + 105, + 106, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 2, + }, + "start": Object { + "column": 32, + "line": 2, + }, + }, + "range": Array [ + 107, + 114, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 2, + }, + "start": Object { + "column": 40, + "line": 2, + }, + }, + "range": Array [ + 115, + 121, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 2, + }, + "start": Object { + "column": 46, + "line": 2, + }, + }, + "range": Array [ + 121, + 122, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 2, + }, + "start": Object { + "column": 48, + "line": 2, + }, + }, + "range": Array [ + 123, + 128, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 2, + }, + "start": Object { + "column": 54, + "line": 2, + }, + }, + "range": Array [ + 129, + 130, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 63, + "line": 2, + }, + "start": Object { + "column": 56, + "line": 2, + }, + }, + "range": Array [ + 131, + 138, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 70, + "line": 2, + }, + "start": Object { + "column": 64, + "line": 2, + }, + }, + "range": Array [ + 139, + 145, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 2, + }, + "start": Object { + "column": 70, + "line": 2, + }, + }, + "range": Array [ + 145, + 146, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 2, + }, + "start": Object { + "column": 72, + "line": 2, + }, + }, + "range": Array [ + 147, + 148, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 86, + "line": 2, + }, + "start": Object { + "column": 74, + "line": 2, + }, + }, + "range": Array [ + 149, + 161, + ], + "type": "Identifier", + "value": "MustBeNumber", + }, + Object { + "loc": Object { + "end": Object { + "column": 87, + "line": 2, + }, + "start": Object { + "column": 86, + "line": 2, + }, + }, + "range": Array [ + 161, + 162, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 88, + "line": 2, + }, + "start": Object { + "column": 87, + "line": 2, + }, + }, + "range": Array [ + 162, + 163, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 89, + "line": 2, + }, + "start": Object { + "column": 88, + "line": 2, + }, + }, + "range": Array [ + 163, + 164, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 91, + "line": 2, + }, + "start": Object { + "column": 90, + "line": 2, + }, + }, + "range": Array [ + 165, + 166, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 97, + "line": 2, + }, + "start": Object { + "column": 92, + "line": 2, + }, + }, + "range": Array [ + 167, + 172, + ], + "type": "Identifier", + "value": "never", + }, + Object { + "loc": Object { + "end": Object { + "column": 98, + "line": 2, + }, + "start": Object { + "column": 97, + "line": 2, + }, + }, + "range": Array [ + 172, + 173, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 3, + }, + "start": Object { + "column": 0, + "line": 3, + }, + }, + "range": Array [ + 174, + 178, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 3, + }, + "start": Object { + "column": 5, + "line": 3, + }, + }, + "range": Array [ + 179, + 181, + ], + "type": "Identifier", + "value": "X5", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 3, + }, + "start": Object { + "column": 7, + "line": 3, + }, + }, + "range": Array [ + 181, + 182, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 3, + }, + "start": Object { + "column": 8, + "line": 3, + }, + }, + "range": Array [ + 182, + 183, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 3, + }, + "start": Object { + "column": 9, + "line": 3, + }, + }, + "range": Array [ + 183, + 184, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 3, + }, + "start": Object { + "column": 11, + "line": 3, + }, + }, + "range": Array [ + 185, + 186, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 3, + }, + "start": Object { + "column": 13, + "line": 3, + }, + }, + "range": Array [ + 187, + 188, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 3, + }, + "start": Object { + "column": 15, + "line": 3, + }, + }, + "range": Array [ + 189, + 196, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 3, + }, + "start": Object { + "column": 23, + "line": 3, + }, + }, + "range": Array [ + 197, + 198, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 3, + }, + "start": Object { + "column": 24, + "line": 3, + }, + }, + "range": Array [ + 198, + 203, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 3, + }, + "start": Object { + "column": 30, + "line": 3, + }, + }, + "range": Array [ + 204, + 205, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 3, + }, + "start": Object { + "column": 32, + "line": 3, + }, + }, + "range": Array [ + 206, + 213, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 3, + }, + "start": Object { + "column": 40, + "line": 3, + }, + }, + "range": Array [ + 214, + 220, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 3, + }, + "start": Object { + "column": 46, + "line": 3, + }, + }, + "range": Array [ + 220, + 221, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 3, + }, + "start": Object { + "column": 48, + "line": 3, + }, + }, + "range": Array [ + 222, + 227, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 3, + }, + "start": Object { + "column": 54, + "line": 3, + }, + }, + "range": Array [ + 228, + 229, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 3, + }, + "start": Object { + "column": 55, + "line": 3, + }, + }, + "range": Array [ + 229, + 230, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 3, + }, + "start": Object { + "column": 57, + "line": 3, + }, + }, + "range": Array [ + 231, + 232, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 3, + }, + "start": Object { + "column": 59, + "line": 3, + }, + }, + "range": Array [ + 233, + 245, + ], + "type": "Identifier", + "value": "MustBeNumber", + }, + Object { + "loc": Object { + "end": Object { + "column": 72, + "line": 3, + }, + "start": Object { + "column": 71, + "line": 3, + }, + }, + "range": Array [ + 245, + 246, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 3, + }, + "start": Object { + "column": 72, + "line": 3, + }, + }, + "range": Array [ + 246, + 247, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 3, + }, + "start": Object { + "column": 73, + "line": 3, + }, + }, + "range": Array [ + 247, + 248, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 76, + "line": 3, + }, + "start": Object { + "column": 75, + "line": 3, + }, + }, + "range": Array [ + 249, + 250, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 82, + "line": 3, + }, + "start": Object { + "column": 77, + "line": 3, + }, + }, + "range": Array [ + 251, + 256, + ], + "type": "Identifier", + "value": "never", + }, + Object { + "loc": Object { + "end": Object { + "column": 83, + "line": 3, + }, + "start": Object { + "column": 82, + "line": 3, + }, + }, + "range": Array [ + 256, + 257, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 4, + }, + "start": Object { + "column": 0, + "line": 4, + }, + }, + "range": Array [ + 258, + 262, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 4, + }, + "start": Object { + "column": 5, + "line": 4, + }, + }, + "range": Array [ + 263, + 265, + ], + "type": "Identifier", + "value": "X6", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 4, + }, + "start": Object { + "column": 7, + "line": 4, + }, + }, + "range": Array [ + 265, + 266, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 4, + }, + "start": Object { + "column": 8, + "line": 4, + }, + }, + "range": Array [ + 266, + 267, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 4, + }, + "start": Object { + "column": 9, + "line": 4, + }, + }, + "range": Array [ + 267, + 268, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 4, + }, + "start": Object { + "column": 11, + "line": 4, + }, + }, + "range": Array [ + 269, + 270, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 4, + }, + "start": Object { + "column": 13, + "line": 4, + }, + }, + "range": Array [ + 271, + 272, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 4, + }, + "start": Object { + "column": 15, + "line": 4, + }, + }, + "range": Array [ + 273, + 280, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 4, + }, + "start": Object { + "column": 23, + "line": 4, + }, + }, + "range": Array [ + 281, + 282, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 4, + }, + "start": Object { + "column": 24, + "line": 4, + }, + }, + "range": Array [ + 282, + 287, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 4, + }, + "start": Object { + "column": 30, + "line": 4, + }, + }, + "range": Array [ + 288, + 289, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 4, + }, + "start": Object { + "column": 31, + "line": 4, + }, + }, + "range": Array [ + 289, + 290, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 4, + }, + "start": Object { + "column": 33, + "line": 4, + }, + }, + "range": Array [ + 291, + 296, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 40, + "line": 4, + }, + "start": Object { + "column": 39, + "line": 4, + }, + }, + "range": Array [ + 297, + 298, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 48, + "line": 4, + }, + "start": Object { + "column": 41, + "line": 4, + }, + }, + "range": Array [ + 299, + 306, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 4, + }, + "start": Object { + "column": 49, + "line": 4, + }, + }, + "range": Array [ + 307, + 313, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 56, + "line": 4, + }, + "start": Object { + "column": 55, + "line": 4, + }, + }, + "range": Array [ + 313, + 314, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 58, + "line": 4, + }, + "start": Object { + "column": 57, + "line": 4, + }, + }, + "range": Array [ + 315, + 316, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 4, + }, + "start": Object { + "column": 59, + "line": 4, + }, + }, + "range": Array [ + 317, + 329, + ], + "type": "Identifier", + "value": "MustBeNumber", + }, + Object { + "loc": Object { + "end": Object { + "column": 72, + "line": 4, + }, + "start": Object { + "column": 71, + "line": 4, + }, + }, + "range": Array [ + 329, + 330, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 4, + }, + "start": Object { + "column": 72, + "line": 4, + }, + }, + "range": Array [ + 330, + 331, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 74, + "line": 4, + }, + "start": Object { + "column": 73, + "line": 4, + }, + }, + "range": Array [ + 331, + 332, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 76, + "line": 4, + }, + "start": Object { + "column": 75, + "line": 4, + }, + }, + "range": Array [ + 333, + 334, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 82, + "line": 4, + }, + "start": Object { + "column": 77, + "line": 4, + }, + }, + "range": Array [ + 335, + 340, + ], + "type": "Identifier", + "value": "never", + }, + Object { + "loc": Object { + "end": Object { + "column": 83, + "line": 4, + }, + "start": Object { + "column": 82, + "line": 4, + }, + }, + "range": Array [ + 340, + 341, + ], + "type": "Punctuator", + "value": ";", + }, + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 5, + }, + "start": Object { + "column": 0, + "line": 5, + }, + }, + "range": Array [ + 342, + 346, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 7, + "line": 5, + }, + "start": Object { + "column": 5, + "line": 5, + }, + }, + "range": Array [ + 347, + 349, + ], + "type": "Identifier", + "value": "X7", + }, + Object { + "loc": Object { + "end": Object { + "column": 8, + "line": 5, + }, + "start": Object { + "column": 7, + "line": 5, + }, + }, + "range": Array [ + 349, + 350, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 9, + "line": 5, + }, + "start": Object { + "column": 8, + "line": 5, + }, + }, + "range": Array [ + 350, + 351, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 10, + "line": 5, + }, + "start": Object { + "column": 9, + "line": 5, + }, + }, + "range": Array [ + 351, + 352, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 5, + }, + "start": Object { + "column": 11, + "line": 5, + }, + }, + "range": Array [ + 353, + 354, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 5, + }, + "start": Object { + "column": 13, + "line": 5, + }, + }, + "range": Array [ + 355, + 356, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 5, + }, + "start": Object { + "column": 15, + "line": 5, + }, + }, + "range": Array [ + 357, + 364, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 5, + }, + "start": Object { + "column": 23, + "line": 5, + }, + }, + "range": Array [ + 365, + 366, + ], + "type": "Punctuator", + "value": "[", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 5, + }, + "start": Object { + "column": 24, + "line": 5, + }, + }, + "range": Array [ + 366, + 371, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 5, + }, + "start": Object { + "column": 30, + "line": 5, + }, + }, + "range": Array [ + 372, + 373, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 5, + }, + "start": Object { + "column": 32, + "line": 5, + }, + }, + "range": Array [ + 374, + 381, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 46, + "line": 5, + }, + "start": Object { + "column": 40, + "line": 5, + }, + }, + "range": Array [ + 382, + 388, + ], + "type": "Identifier", + "value": "string", + }, + Object { + "loc": Object { + "end": Object { + "column": 47, + "line": 5, + }, + "start": Object { + "column": 46, + "line": 5, + }, + }, + "range": Array [ + 388, + 389, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 53, + "line": 5, + }, + "start": Object { + "column": 48, + "line": 5, + }, + }, + "range": Array [ + 390, + 395, + ], + "type": "Identifier", + "value": "infer", + }, + Object { + "loc": Object { + "end": Object { + "column": 55, + "line": 5, + }, + "start": Object { + "column": 54, + "line": 5, + }, + }, + "range": Array [ + 396, + 397, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 63, + "line": 5, + }, + "start": Object { + "column": 56, + "line": 5, + }, + }, + "range": Array [ + 398, + 405, + ], + "type": "Keyword", + "value": "extends", + }, + Object { + "loc": Object { + "end": Object { + "column": 70, + "line": 5, + }, + "start": Object { + "column": 64, + "line": 5, + }, + }, + "range": Array [ + 406, + 412, + ], + "type": "Identifier", + "value": "number", + }, + Object { + "loc": Object { + "end": Object { + "column": 71, + "line": 5, + }, + "start": Object { + "column": 70, + "line": 5, + }, + }, + "range": Array [ + 412, + 413, + ], + "type": "Punctuator", + "value": "]", + }, + Object { + "loc": Object { + "end": Object { + "column": 73, + "line": 5, + }, + "start": Object { + "column": 72, + "line": 5, + }, + }, + "range": Array [ + 414, + 415, + ], + "type": "Punctuator", + "value": "?", + }, + Object { + "loc": Object { + "end": Object { + "column": 75, + "line": 5, + }, + "start": Object { + "column": 74, + "line": 5, + }, + }, + "range": Array [ + 416, + 417, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 77, + "line": 5, + }, + "start": Object { + "column": 76, + "line": 5, + }, + }, + "range": Array [ + 418, + 419, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 83, + "line": 5, + }, + "start": Object { + "column": 78, + "line": 5, + }, + }, + "range": Array [ + 420, + 425, + ], + "type": "Identifier", + "value": "never", + }, + Object { + "loc": Object { + "end": Object { + "column": 84, + "line": 5, + }, + "start": Object { + "column": 83, + "line": 5, + }, + }, + "range": Array [ + 425, + 426, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer.src.ts.shot index d55b6ac728e0..9534b875bd9b 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/conditional-infer.src.ts.shot @@ -94,6 +94,7 @@ Object { "typeParameter": Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 36, @@ -122,6 +123,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 35, 36, @@ -248,6 +250,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 14, @@ -276,6 +279,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 13, 14, diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-generic.src.ts.shot index d0434a7edb77..43b72d5dff0f 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/constructor-generic.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/constructor-generic.src.ts.shot @@ -197,6 +197,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 13, @@ -225,6 +226,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 12, 13, diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/function-generic.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/function-generic.src.ts.shot index 20329d59abb4..3d0a92854878 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/function-generic.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/function-generic.src.ts.shot @@ -196,6 +196,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 9, @@ -224,6 +225,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 8, 9, diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/intersection-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/intersection-type.src.ts.shot index de61acf25c46..7e56c87cf8bc 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/intersection-type.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/intersection-type.src.ts.shot @@ -274,6 +274,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 17, @@ -302,6 +303,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 16, 17, diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/mapped-named-type.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/mapped-named-type.src.ts.shot index 4adec74e80a9..ad9603c0953a 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/mapped-named-type.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/mapped-named-type.src.ts.shot @@ -234,6 +234,7 @@ Object { }, }, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 15, @@ -262,6 +263,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 20, 32, @@ -284,6 +286,7 @@ Object { Object { "constraint": undefined, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 11, @@ -312,6 +315,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 10, 11, diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/mapped-readonly-minus.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/mapped-readonly-minus.src.ts.shot index 5bc1ed74e225..b4f571e2c118 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/mapped-readonly-minus.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/mapped-readonly-minus.src.ts.shot @@ -94,6 +94,7 @@ Object { "type": "TSStringKeyword", }, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 33, @@ -122,6 +123,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 22, 33, diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/mapped-readonly-plus.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/mapped-readonly-plus.src.ts.shot index 0529961e6651..f3ba73b4aa51 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/mapped-readonly-plus.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/mapped-readonly-plus.src.ts.shot @@ -94,6 +94,7 @@ Object { "type": "TSStringKeyword", }, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 33, @@ -122,6 +123,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 22, 33, diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/mapped-readonly.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/mapped-readonly.src.ts.shot index b18350797d01..cce96c961cc5 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/mapped-readonly.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/mapped-readonly.src.ts.shot @@ -94,6 +94,7 @@ Object { "type": "TSStringKeyword", }, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 32, @@ -122,6 +123,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 21, 32, diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/mapped-untypped.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/mapped-untypped.src.ts.shot index d254c7d59336..27b7b9c9c4d9 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/mapped-untypped.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/mapped-untypped.src.ts.shot @@ -75,6 +75,7 @@ Object { "type": "TSStringKeyword", }, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 23, @@ -103,6 +104,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 12, 23, diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/mapped.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/mapped.src.ts.shot index 75f22d34e024..1689f5647b9f 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/mapped.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/mapped.src.ts.shot @@ -92,6 +92,7 @@ Object { "type": "TSStringKeyword", }, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 23, @@ -120,6 +121,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 12, 23, diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-in-and-out.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-in-and-out.src.ts.shot new file mode 100644 index 000000000000..26e233652d4c --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-in-and-out.src.ts.shot @@ -0,0 +1,626 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types optional-variance-in-and-out.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Mapper", + "range": Array [ + 5, + 11, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 28, + 32, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 27, + 38, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + }, + "type": "TSFunctionType", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": true, + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + }, + "out": false, + "range": Array [ + 12, + 16, + ], + "type": "TSTypeParameter", + }, + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "U", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "out": true, + "range": Array [ + 18, + 23, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 11, + 24, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 11, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 11, + ], + "type": "Identifier", + "value": "Mapper", + }, + Object { + "loc": Object { + "end": Object { + "column": 12, + "line": 1, + }, + "start": Object { + "column": 11, + "line": 1, + }, + }, + "range": Array [ + 11, + 12, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 12, + "line": 1, + }, + }, + "range": Array [ + 12, + 14, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 16, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 16, + "line": 1, + }, + }, + "range": Array [ + 16, + 17, + ], + "type": "Punctuator", + "value": ",", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + "value": "out", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 36, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + "value": "U", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-in-out.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-in-out.src.ts.shot new file mode 100644 index 000000000000..9639322188cd --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-in-out.src.ts.shot @@ -0,0 +1,551 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types optional-variance-in-out.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Processor", + "range": Array [ + 5, + 14, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 39, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 28, + 32, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 32, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 27, + 38, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 38, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + }, + "type": "TSFunctionType", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": true, + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + }, + "out": true, + "range": Array [ + 15, + 23, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 14, + 24, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 40, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 14, + ], + "type": "Identifier", + "value": "Processor", + }, + Object { + "loc": Object { + "end": Object { + "column": 15, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 15, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 15, + "line": 1, + }, + }, + "range": Array [ + 15, + 17, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 21, + ], + "type": "Identifier", + "value": "out", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 26, + "line": 1, + }, + "start": Object { + "column": 25, + "line": 1, + }, + }, + "range": Array [ + 25, + 26, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 29, + "line": 1, + }, + "start": Object { + "column": 28, + "line": 1, + }, + }, + "range": Array [ + 28, + 29, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 32, + "line": 1, + }, + "start": Object { + "column": 31, + "line": 1, + }, + }, + "range": Array [ + 31, + 32, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 33, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 33, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 34, + "line": 1, + }, + }, + "range": Array [ + 34, + 36, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 38, + "line": 1, + }, + "start": Object { + "column": 37, + "line": 1, + }, + }, + "range": Array [ + 37, + 38, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 39, + "line": 1, + }, + "start": Object { + "column": 38, + "line": 1, + }, + }, + "range": Array [ + 38, + 39, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-in.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-in.src.ts.shot new file mode 100644 index 000000000000..bf2e85f702ff --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-in.src.ts.shot @@ -0,0 +1,514 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types optional-variance-in.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Consumer", + "range": Array [ + 5, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 37, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "params": Array [ + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "name": "x", + "range": Array [ + 23, + 27, + ], + "type": "Identifier", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 27, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + }, + }, + ], + "range": Array [ + 22, + 36, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 36, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 36, + ], + "type": "TSVoidKeyword", + }, + }, + "type": "TSFunctionType", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": true, + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + }, + "out": false, + "range": Array [ + 14, + 18, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 13, + 19, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 38, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 13, + ], + "type": "Identifier", + "value": "Consumer", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 16, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 16, + ], + "type": "Keyword", + "value": "in", + }, + Object { + "loc": Object { + "end": Object { + "column": 18, + "line": 1, + }, + "start": Object { + "column": 17, + "line": 1, + }, + }, + "range": Array [ + 17, + 18, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 21, + "line": 1, + }, + "start": Object { + "column": 20, + "line": 1, + }, + }, + "range": Array [ + 20, + 21, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 23, + "line": 1, + }, + "start": Object { + "column": 22, + "line": 1, + }, + }, + "range": Array [ + 22, + 23, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Identifier", + "value": "x", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ":", + }, + Object { + "loc": Object { + "end": Object { + "column": 27, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 27, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 27, + "line": 1, + }, + }, + "range": Array [ + 27, + 28, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 31, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 36, + "line": 1, + }, + "start": Object { + "column": 32, + "line": 1, + }, + }, + "range": Array [ + 32, + 36, + ], + "type": "Keyword", + "value": "void", + }, + Object { + "loc": Object { + "end": Object { + "column": 37, + "line": 1, + }, + "start": Object { + "column": 36, + "line": 1, + }, + }, + "range": Array [ + 36, + 37, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-out.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-out.src.ts.shot new file mode 100644 index 000000000000..04c6769229f4 --- /dev/null +++ b/packages/typescript-estree/tests/snapshots/typescript/types/optional-variance-out.src.ts.shot @@ -0,0 +1,407 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`typescript types optional-variance-out.src 1`] = ` +Object { + "body": Array [ + Object { + "id": Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "name": "Provider", + "range": Array [ + 5, + 13, + ], + "type": "Identifier", + }, + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 31, + ], + "type": "TSTypeAliasDeclaration", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "params": Array [], + "range": Array [ + 23, + 30, + ], + "returnType": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 30, + ], + "type": "TSTypeAnnotation", + "typeAnnotation": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "TSTypeReference", + "typeName": Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + }, + "typeParameters": undefined, + }, + }, + "type": "TSFunctionType", + }, + "typeParameters": Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "params": Array [ + Object { + "constraint": undefined, + "default": undefined, + "in": false, + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "name": Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "name": "T", + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + }, + "out": true, + "range": Array [ + 14, + 19, + ], + "type": "TSTypeParameter", + }, + ], + "range": Array [ + 13, + 20, + ], + "type": "TSTypeParameterDeclaration", + }, + }, + ], + "comments": Array [], + "loc": Object { + "end": Object { + "column": 0, + "line": 2, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 32, + ], + "sourceType": "script", + "tokens": Array [ + Object { + "loc": Object { + "end": Object { + "column": 4, + "line": 1, + }, + "start": Object { + "column": 0, + "line": 1, + }, + }, + "range": Array [ + 0, + 4, + ], + "type": "Identifier", + "value": "type", + }, + Object { + "loc": Object { + "end": Object { + "column": 13, + "line": 1, + }, + "start": Object { + "column": 5, + "line": 1, + }, + }, + "range": Array [ + 5, + 13, + ], + "type": "Identifier", + "value": "Provider", + }, + Object { + "loc": Object { + "end": Object { + "column": 14, + "line": 1, + }, + "start": Object { + "column": 13, + "line": 1, + }, + }, + "range": Array [ + 13, + 14, + ], + "type": "Punctuator", + "value": "<", + }, + Object { + "loc": Object { + "end": Object { + "column": 17, + "line": 1, + }, + "start": Object { + "column": 14, + "line": 1, + }, + }, + "range": Array [ + 14, + 17, + ], + "type": "Identifier", + "value": "out", + }, + Object { + "loc": Object { + "end": Object { + "column": 19, + "line": 1, + }, + "start": Object { + "column": 18, + "line": 1, + }, + }, + "range": Array [ + 18, + 19, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 20, + "line": 1, + }, + "start": Object { + "column": 19, + "line": 1, + }, + }, + "range": Array [ + 19, + 20, + ], + "type": "Punctuator", + "value": ">", + }, + Object { + "loc": Object { + "end": Object { + "column": 22, + "line": 1, + }, + "start": Object { + "column": 21, + "line": 1, + }, + }, + "range": Array [ + 21, + 22, + ], + "type": "Punctuator", + "value": "=", + }, + Object { + "loc": Object { + "end": Object { + "column": 24, + "line": 1, + }, + "start": Object { + "column": 23, + "line": 1, + }, + }, + "range": Array [ + 23, + 24, + ], + "type": "Punctuator", + "value": "(", + }, + Object { + "loc": Object { + "end": Object { + "column": 25, + "line": 1, + }, + "start": Object { + "column": 24, + "line": 1, + }, + }, + "range": Array [ + 24, + 25, + ], + "type": "Punctuator", + "value": ")", + }, + Object { + "loc": Object { + "end": Object { + "column": 28, + "line": 1, + }, + "start": Object { + "column": 26, + "line": 1, + }, + }, + "range": Array [ + 26, + 28, + ], + "type": "Punctuator", + "value": "=>", + }, + Object { + "loc": Object { + "end": Object { + "column": 30, + "line": 1, + }, + "start": Object { + "column": 29, + "line": 1, + }, + }, + "range": Array [ + 29, + 30, + ], + "type": "Identifier", + "value": "T", + }, + Object { + "loc": Object { + "end": Object { + "column": 31, + "line": 1, + }, + "start": Object { + "column": 30, + "line": 1, + }, + }, + "range": Array [ + 30, + 31, + ], + "type": "Punctuator", + "value": ";", + }, + ], + "type": "Program", +} +`; diff --git a/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-4.src.ts.shot b/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-4.src.ts.shot index fafb3e04c2f7..44900a50b51e 100644 --- a/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-4.src.ts.shot +++ b/packages/typescript-estree/tests/snapshots/typescript/types/template-literal-type-4.src.ts.shot @@ -559,6 +559,7 @@ Object { "type": "TSStringKeyword", }, "default": undefined, + "in": false, "loc": Object { "end": Object { "column": 42, @@ -587,6 +588,7 @@ Object { ], "type": "Identifier", }, + "out": false, "range": Array [ 26, 42, diff --git a/packages/utils/CHANGELOG.md b/packages/utils/CHANGELOG.md index 57db0424e2dd..1c374c4ca114 100644 --- a/packages/utils/CHANGELOG.md +++ b/packages/utils/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) + +**Note:** Version bump only for package @typescript-eslint/utils + + + + + # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) diff --git a/packages/utils/jest.config.js b/packages/utils/jest.config.js index 5f1ea3f4bcb0..910991b20cff 100644 --- a/packages/utils/jest.config.js +++ b/packages/utils/jest.config.js @@ -4,5 +4,4 @@ /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { ...require('../../jest.config.base.js'), - testRegex: './tests/.+\\.test\\.ts$', }; diff --git a/packages/utils/package.json b/packages/utils/package.json index 130428868ca1..502ddbdea2c1 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/utils", - "version": "5.25.0", + "version": "5.26.0", "description": "Utilities for working with TypeScript + ESLint together", "keywords": [ "eslint", @@ -40,9 +40,9 @@ }, "dependencies": { "@types/json-schema": "^7.0.9", - "@typescript-eslint/scope-manager": "5.25.0", - "@typescript-eslint/types": "5.25.0", - "@typescript-eslint/typescript-estree": "5.25.0", + "@typescript-eslint/scope-manager": "5.26.0", + "@typescript-eslint/types": "5.26.0", + "@typescript-eslint/typescript-estree": "5.26.0", "eslint-scope": "^5.1.1", "eslint-utils": "^3.0.0" }, diff --git a/packages/visitor-keys/CHANGELOG.md b/packages/visitor-keys/CHANGELOG.md index df600cb432ef..3447d5fcbe77 100644 --- a/packages/visitor-keys/CHANGELOG.md +++ b/packages/visitor-keys/CHANGELOG.md @@ -3,6 +3,17 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) + + +### Features + +* [4.7] support instantiation expressions ([#4938](https://github.com/typescript-eslint/typescript-eslint/issues/4938)) ([79fbc77](https://github.com/typescript-eslint/typescript-eslint/commit/79fbc7743ae5dce3190f8168776e0204755390ad)) + + + + + # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) **Note:** Version bump only for package @typescript-eslint/visitor-keys diff --git a/packages/visitor-keys/jest.config.js b/packages/visitor-keys/jest.config.js index 77fe4d022a95..910991b20cff 100644 --- a/packages/visitor-keys/jest.config.js +++ b/packages/visitor-keys/jest.config.js @@ -4,5 +4,4 @@ /** @type {import('@jest/types').Config.InitialOptions} */ module.exports = { ...require('../../jest.config.base.js'), - testRegex: ['./tests/.+\\.test\\.ts$'], }; diff --git a/packages/visitor-keys/package.json b/packages/visitor-keys/package.json index 0cf35c8f412c..f7b0b512ace4 100644 --- a/packages/visitor-keys/package.json +++ b/packages/visitor-keys/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/visitor-keys", - "version": "5.25.0", + "version": "5.26.0", "description": "Visitor keys used to help traverse the TypeScript-ESTree AST", "keywords": [ "eslint", @@ -38,7 +38,7 @@ "typecheck": "tsc -p tsconfig.json --noEmit" }, "dependencies": { - "@typescript-eslint/types": "5.25.0", + "@typescript-eslint/types": "5.26.0", "eslint-visitor-keys": "^3.3.0" }, "devDependencies": { diff --git a/packages/visitor-keys/src/visitor-keys.ts b/packages/visitor-keys/src/visitor-keys.ts index 3e49d2d1b484..f7be9f1aed8c 100644 --- a/packages/visitor-keys/src/visitor-keys.ts +++ b/packages/visitor-keys/src/visitor-keys.ts @@ -100,6 +100,7 @@ const additionalKeys: AdditionalKeys = { TSIndexedAccessType: ['indexType', 'objectType'], TSIndexSignature: ['parameters', 'typeAnnotation'], TSInferType: ['typeParameter'], + TSInstantiationExpression: ['expression', 'typeParameters'], TSInterfaceBody: ['body'], TSInterfaceDeclaration: ['id', 'typeParameters', 'extends', 'body'], TSInterfaceHeritage: ['expression', 'typeParameters'], diff --git a/packages/website-eslint/CHANGELOG.md b/packages/website-eslint/CHANGELOG.md index f5a79fd6bb42..046524952cbb 100644 --- a/packages/website-eslint/CHANGELOG.md +++ b/packages/website-eslint/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) + +**Note:** Version bump only for package @typescript-eslint/website-eslint + + + + + # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) **Note:** Version bump only for package @typescript-eslint/website-eslint diff --git a/packages/website-eslint/package.json b/packages/website-eslint/package.json index d437e42c6c05..cdb3e2847d48 100644 --- a/packages/website-eslint/package.json +++ b/packages/website-eslint/package.json @@ -1,6 +1,6 @@ { "name": "@typescript-eslint/website-eslint", - "version": "5.25.0", + "version": "5.26.0", "private": true, "description": "ESLint which works in browsers.", "engines": { @@ -16,19 +16,19 @@ "format": "prettier --write \"./**/*.{ts,js,json,md}\" --ignore-path ../../.prettierignore" }, "dependencies": { - "@typescript-eslint/types": "5.25.0", - "@typescript-eslint/utils": "5.25.0" + "@typescript-eslint/types": "5.26.0", + "@typescript-eslint/utils": "5.26.0" }, "devDependencies": { "@rollup/plugin-commonjs": "^22.0.0", "@rollup/plugin-json": "^4.1.0", "@rollup/plugin-node-resolve": "^13.3.0", "@rollup/pluginutils": "^4.2.1", - "@typescript-eslint/eslint-plugin": "5.25.0", - "@typescript-eslint/parser": "5.25.0", - "@typescript-eslint/scope-manager": "5.25.0", - "@typescript-eslint/typescript-estree": "5.25.0", - "@typescript-eslint/visitor-keys": "5.25.0", + "@typescript-eslint/eslint-plugin": "5.26.0", + "@typescript-eslint/parser": "5.26.0", + "@typescript-eslint/scope-manager": "5.26.0", + "@typescript-eslint/typescript-estree": "5.26.0", + "@typescript-eslint/visitor-keys": "5.26.0", "eslint": "*", "rollup": "^2.72.1", "semver": "^7.3.7" diff --git a/packages/website/CHANGELOG.md b/packages/website/CHANGELOG.md index 3ffe4efc0eeb..0d22e43b1b43 100644 --- a/packages/website/CHANGELOG.md +++ b/packages/website/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.26.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.25.0...v5.26.0) (2022-05-23) + +**Note:** Version bump only for package website + + + + + # [5.25.0](https://github.com/typescript-eslint/typescript-eslint/compare/v5.24.0...v5.25.0) (2022-05-17) **Note:** Version bump only for package website diff --git a/packages/website/cypress.json b/packages/website/cypress.json index 3f950c1a9af3..904719148b0f 100644 --- a/packages/website/cypress.json +++ b/packages/website/cypress.json @@ -1,4 +1,5 @@ { "baseUrl": "http://localhost:3000", - "fixturesFolder": false + "fixturesFolder": false, + "pageLoadTimeout": 600000 } diff --git a/packages/website/docusaurus.config.js b/packages/website/docusaurus.config.js index 7add99ed218c..a06a8e0367dc 100644 --- a/packages/website/docusaurus.config.js +++ b/packages/website/docusaurus.config.js @@ -15,8 +15,8 @@ const config = { tagline: 'Tooling which enables ESLint to support TypeScript', url: 'https://typescript-eslint.io', baseUrl: '/', - onBrokenLinks: 'warn', // TODO: 'throw' - onBrokenMarkdownLinks: 'warn', + onBrokenLinks: 'throw', + onBrokenMarkdownLinks: 'warn', // If Markdown link resolution fails, it will result in a broken link anyways favicon: 'img/favicon.ico', organizationName: 'typescript-eslint', projectName: 'typescript-eslint', diff --git a/packages/website/package.json b/packages/website/package.json index 8cf52af9233c..35309c4e44df 100644 --- a/packages/website/package.json +++ b/packages/website/package.json @@ -1,6 +1,6 @@ { "name": "website", - "version": "5.25.0", + "version": "5.26.0", "private": true, "scripts": { "build": "docusaurus build", @@ -14,13 +14,13 @@ "test:open": "cypress open" }, "dependencies": { - "@babel/runtime": "7.17.9", + "@babel/runtime": "7.18.0", "@docusaurus/core": "2.0.0-beta.20", "@docusaurus/preset-classic": "2.0.0-beta.20", "@docusaurus/remark-plugin-npm2yarn": "2.0.0-beta.20", "@docusaurus/theme-common": "2.0.0-beta.20", "@mdx-js/react": "1.6.22", - "@typescript-eslint/website-eslint": "5.25.0", + "@typescript-eslint/website-eslint": "5.26.0", "clsx": "^1.1.1", "eslint": "*", "json5": "^2.2.1", @@ -37,7 +37,7 @@ "@types/react-helmet": "^6.1.5", "@types/react-router-dom": "^5.3.3", "copy-webpack-plugin": "^10.2.4", - "cypress": "8.7.0", + "cypress": "8.3.0", "cypress-axe": "^0.14.0", "eslint-plugin-jsx-a11y": "^6.5.1", "eslint-plugin-react": "^7.29.4", diff --git a/yarn.lock b/yarn.lock index 95fbd5252d85..f2808b7eed8d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1145,10 +1145,10 @@ core-js-pure "^3.20.2" regenerator-runtime "^0.13.4" -"@babel/runtime@7.17.9", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.3", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.14.6", "@babel/runtime@^7.16.3", "@babel/runtime@^7.17.9", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4": - version "7.17.9" - resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.17.9.tgz#d19fbf802d01a8cb6cf053a64e472d42c434ba72" - integrity sha512-lSiBBvodq29uShpWGNbgFdKYNiFDo5/HIYsaCEY9ff4sb10x9jizo2+pRrSyF4jKZCXqgzuqBOQKbUm90gQwJg== +"@babel/runtime@7.18.0", "@babel/runtime@^7.1.2", "@babel/runtime@^7.10.2", "@babel/runtime@^7.10.3", "@babel/runtime@^7.12.1", "@babel/runtime@^7.12.13", "@babel/runtime@^7.12.5", "@babel/runtime@^7.14.6", "@babel/runtime@^7.16.3", "@babel/runtime@^7.17.9", "@babel/runtime@^7.7.6", "@babel/runtime@^7.8.4": + version "7.18.0" + resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.18.0.tgz#6d77142a19cb6088f0af662af1ada37a604d34ae" + integrity sha512-YMQvx/6nKEaucl0MY56mwIG483xk8SDNdlUwb2Ts6FUpr7fm85DxEmsY18LXBNhcTz6tO6JwZV8w1W06v8UKeg== dependencies: regenerator-runtime "^0.13.4" @@ -1178,9 +1178,9 @@ globals "^11.1.0" "@babel/types@^7.0.0", "@babel/types@^7.12.7", "@babel/types@^7.15.6", "@babel/types@^7.16.0", "@babel/types@^7.16.7", "@babel/types@^7.16.8", "@babel/types@^7.17.0", "@babel/types@^7.17.10", "@babel/types@^7.17.12", "@babel/types@^7.3.0", "@babel/types@^7.3.3", "@babel/types@^7.4.4": - version "7.17.12" - resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.17.12.tgz#1210690a516489c0200f355d87619157fbbd69a0" - integrity sha512-rH8i29wcZ6x9xjzI5ILHL/yZkbQnCERdHlogKuIb4PUr7do4iT8DPekrTbBLWTnRQm6U0GYABbTMSzijmEqlAg== + version "7.18.0" + resolved "https://registry.yarnpkg.com/@babel/types/-/types-7.18.0.tgz#ef523ea349722849cb4bf806e9342ede4d071553" + integrity sha512-vhAmLPAiC8j9K2GnsnLPCIH5wCrPpYIVBCWRBFDCB7Y/BXLqi/O+1RSTTM2bsmg6U/551+FCf9PNPxjABmxHTw== dependencies: "@babel/helper-validator-identifier" "^7.16.7" to-fast-properties "^2.0.0" @@ -1615,7 +1615,7 @@ dependencies: "@cspotcode/source-map-consumer" "0.8.0" -"@cypress/request@^2.88.6": +"@cypress/request@^2.88.5": version "2.88.10" resolved "https://registry.yarnpkg.com/@cypress/request/-/request-2.88.10.tgz#b66d76b07f860d3a4b8d7a0604d020c662752cce" integrity sha512-Zp7F+R93N0yZyG34GutyTNr+okam7s/Fzc1+i3kcqOP8vk6OuajuE9qZJ6Rs+10/1JFtXFYMdyarnU1rZuJesg== @@ -3071,9 +3071,9 @@ "@rushstack/node-core-library" "3.45.5" "@microsoft/api-extractor@^7.23.2": - version "7.24.0" - resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.24.0.tgz#be497360b06891ed8b660e7802c4503ceb736693" - integrity sha512-cC5Vcu3N2OJh1G5v136JYtE4QQtQYq6mLiL8YXzFgu8aoq8T88kzq3/TxlihJvqGnrD96pf4PjS2Yg8RNYTQYw== + version "7.24.1" + resolved "https://registry.yarnpkg.com/@microsoft/api-extractor/-/api-extractor-7.24.1.tgz#cbbe32a5f4f32717b60f593cdc172b99e5c76fae" + integrity sha512-RjcKRvKRAtTK4z8UdC2qYsvgTYHEYvdsqF4QGoX4mNAVo7s6Jj4zcHtSrMEQMTUHujZbSd5+ihI5ktISp338mQ== dependencies: "@microsoft/api-extractor-model" "7.17.3" "@microsoft/tsdoc" "0.14.1" @@ -3674,89 +3674,89 @@ dependencies: source-map-support "^0.5.21" -"@swc/core-android-arm-eabi@1.2.185": - version "1.2.185" - resolved "https://registry.yarnpkg.com/@swc/core-android-arm-eabi/-/core-android-arm-eabi-1.2.185.tgz#6fca8a364428c3ff17fd960176a8c5a1047748c4" - integrity sha512-/ZTj5yaPkPC0UwggYN+y4d2DNZJI+b1y1gi4twrQJz997OMU032Hi9/59VxHFzHNxlzhIuCJYcbxOxi1Aqk2bA== - -"@swc/core-android-arm64@1.2.185": - version "1.2.185" - resolved "https://registry.yarnpkg.com/@swc/core-android-arm64/-/core-android-arm64-1.2.185.tgz#592fa96fb17036d920f57c8f36c859acf1dacb53" - integrity sha512-TgidzM+7H0YTIABu2ILI8MRDiIzcFULz5vIUWbhLwypPH9vJCFcDnAv5rBpg/4KBMzuSI6BNNBIcf/8Wc9e0HA== - -"@swc/core-darwin-arm64@1.2.185": - version "1.2.185" - resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.2.185.tgz#5dfbb3425ddf479c8875a3737e1de5b127e335b2" - integrity sha512-segMc9FVYz+M5KzpPJR+M20Mmeq4ZQw4gi6rt0HXNpSPykm+oe/wb1CZbMk/9SpMaevpXOOZa0HHBM2ue+WhVA== - -"@swc/core-darwin-x64@1.2.185": - version "1.2.185" - resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.2.185.tgz#e97ed012ff08fb39dcc51fc07233f4425fa89408" - integrity sha512-PL1Xq6R5zpBbYZsWJU0xK2/WQlhag/Kiq1eZd6ftSLaxn0q00wdSGPpzOqK5FTYAqi+5R1CWM/kCOHFoSlYDfg== - -"@swc/core-freebsd-x64@1.2.185": - version "1.2.185" - resolved "https://registry.yarnpkg.com/@swc/core-freebsd-x64/-/core-freebsd-x64-1.2.185.tgz#ba12147270c754c47eee9a99f08de75172ae4bb1" - integrity sha512-scaFxGfV7RhJrrCGzouwFe1XOzJvY/WjYWysHuD+slSdn3pjSnxXtX2Q9jPIYF0bmIcbTp4D6V8VITLhmfkzEA== - -"@swc/core-linux-arm-gnueabihf@1.2.185": - version "1.2.185" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.2.185.tgz#4bd8ff733e06c8ea0dc916208f8fdeb907f25256" - integrity sha512-WQ84BVGF0al3ynWBeXuEpO7y6h8Bh4AXr+Ys2YaEgyZtAZ6zWUi3Ca4ktFWwpACSm0XUUB3lhlapUcqXJE8lZg== - -"@swc/core-linux-arm64-gnu@1.2.185": - version "1.2.185" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.2.185.tgz#8abe168271f4ba6767da87fb4386ccea388fc324" - integrity sha512-INrmHqV5ti0ROS9FeGXPF5ZcIAWZ9Sp+Xbn5isWZ9owqT0c2CU4f9+w+OzNMMDKVFe2ARvlH/D927mLIgwqDmQ== - -"@swc/core-linux-arm64-musl@1.2.185": - version "1.2.185" - resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.2.185.tgz#2352673452ac2553d45181d53351cb00d378d848" - integrity sha512-OEwVBlypM7SOZqpa82hIh9jeiu/eSXG+J+R0vekcWz7EkW5zb504uyGPeZJKMqX23I5GZtBpk96UUbhnNCaYUg== - -"@swc/core-linux-x64-gnu@1.2.185": - version "1.2.185" - resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.2.185.tgz#058444fa372374f2f7f2f2d09c03085f928c8f12" - integrity sha512-H8LnCdViP7JsFlDE02w5czlKQWnAAM9ZN3oZnvAuTod2gJBjTJ4eZ3h9d+EQdcszw7Csh+IwXbmPz0mPwaR0vQ== - -"@swc/core-linux-x64-musl@1.2.185": - version "1.2.185" - resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.2.185.tgz#a8f473965e87acb03057d6b4790f86857e5ce4ea" - integrity sha512-DRHmhjCsA2FloF+6/HMxJ8bkdfddAY/wqnpuW/l3CPUyL3VMDmvSiZICN8f/J8LKpGfDV2FdczztmbGi14jO+g== - -"@swc/core-win32-arm64-msvc@1.2.185": - version "1.2.185" - resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.2.185.tgz#d8fc5bf11e67664d54a84ad37d9ac7d69df1a317" - integrity sha512-0BmuvU+Lfz5n1/ihh30UF2Viu9JJn3S3YC9QD9BfF80ueEl8KT4JihhJGuEG3XuZk5+35o2oZiCRkn6NKI/qpA== - -"@swc/core-win32-ia32-msvc@1.2.185": - version "1.2.185" - resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.2.185.tgz#cbd3a4ad67bf40754143fafc87baed6021e9a780" - integrity sha512-yRNa/frm5MeXJMpj6V6uQy5a0yfO9q6ZOQ4L+439UH8vBcgIZYOG07bJGvxeUjaKkkrhfzEu5Q8fdXTzPgGeAA== - -"@swc/core-win32-x64-msvc@1.2.185": - version "1.2.185" - resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.2.185.tgz#f2459a88783ed95257229e41034fd913b487c5b4" - integrity sha512-nLF0AKADjeR3Rr05lWoKOeDbGBFpmbFnGkpLJK9EAwAIQUC9lDRYIps5yinPZsgqBwa0RCUsxzS3PjbWEY18bg== +"@swc/core-android-arm-eabi@1.2.189": + version "1.2.189" + resolved "https://registry.yarnpkg.com/@swc/core-android-arm-eabi/-/core-android-arm-eabi-1.2.189.tgz#a8060c2ec7bd93bd9907c3059c44a832eda57b6d" + integrity sha512-0kN3Le6QzFFz+Lc6a/tf/RkJXubWwWaHxF4c0bVm4AKIFf4nRlUCEqEkjdVaZvL92rpBMHaEEBuIIz3T8DqTTQ== + +"@swc/core-android-arm64@1.2.189": + version "1.2.189" + resolved "https://registry.yarnpkg.com/@swc/core-android-arm64/-/core-android-arm64-1.2.189.tgz#c9a7ebaecbef4488db3394e660dd5c2abfa5c173" + integrity sha512-smsb+YkDw2OKwg66Z63E/G4NlFApDbsiOPmZXFZbtZbNBD9v+wnk6WVA//XR1bdUI9VbzNKlMPKJxQTE685QDw== + +"@swc/core-darwin-arm64@1.2.189": + version "1.2.189" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-arm64/-/core-darwin-arm64-1.2.189.tgz#883098686504692218e88877b224e06db2a93c86" + integrity sha512-OGjZRkTulKirJMLYbW9etb59lA9ueDXVwYRVD9SrNh8tRMTf0Nq+SUT/C3LVhBBGC4KSdWOzBAYbDTTdsnY++Q== + +"@swc/core-darwin-x64@1.2.189": + version "1.2.189" + resolved "https://registry.yarnpkg.com/@swc/core-darwin-x64/-/core-darwin-x64-1.2.189.tgz#38ba12dc3b07d96761dc895dd43e14ba3323129f" + integrity sha512-BEcxnBHx51514Voe2dn/y1y5H9VNyw7Zpp9+mPekZqx5o/onPD5wZ1ZfAsPrA4UlvM3v16u6ITE/cLawJ/GdAQ== + +"@swc/core-freebsd-x64@1.2.189": + version "1.2.189" + resolved "https://registry.yarnpkg.com/@swc/core-freebsd-x64/-/core-freebsd-x64-1.2.189.tgz#0cee19a1382ee97a7be2ea057cf48f5e08c66038" + integrity sha512-B6g2NWeh2iw6WPOaM19Uj3VE4se6alT265kWibLUshjcofRfnYT1lNhhkrF1D0EVnpC8I96I/xXNQo4Am9z4zQ== + +"@swc/core-linux-arm-gnueabihf@1.2.189": + version "1.2.189" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm-gnueabihf/-/core-linux-arm-gnueabihf-1.2.189.tgz#612010e31969387de6acde69d8250fd74f784be1" + integrity sha512-6WhPG9pyN5AahQTVQk8MoN1I9Z/Ytfqizuie1wV7mW8FMNmMkiJvBekKtE6ftxu80Hqa34r86WfEwmJKm5MqYw== + +"@swc/core-linux-arm64-gnu@1.2.189": + version "1.2.189" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-gnu/-/core-linux-arm64-gnu-1.2.189.tgz#0fe98d1ca0a3441bfe4033fbe7fc19d87019f640" + integrity sha512-frJTGnxsDe7h2d7BtnBivOdOJTtabkQIIZmHd4JHqafcoekI6teyveIax17axLyimvWl278yTo3hf7ePagD/eg== + +"@swc/core-linux-arm64-musl@1.2.189": + version "1.2.189" + resolved "https://registry.yarnpkg.com/@swc/core-linux-arm64-musl/-/core-linux-arm64-musl-1.2.189.tgz#bb28e598e028745129e0eb9458184eb5b7efe685" + integrity sha512-27K38LoZpME5lojDJIUNo7zdTDwAKLm0BMQ7HXWcYOyiDAekhSidI+SrBWxCfLzfuClhFu6/VE3E7j32VFJsiA== + +"@swc/core-linux-x64-gnu@1.2.189": + version "1.2.189" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-gnu/-/core-linux-x64-gnu-1.2.189.tgz#365073c3183e40080be900337987fcc4d2270fff" + integrity sha512-Ha5oJKOyQm9w7+e+WdRm4ypijzEmglWZGtgBR6vV6ViqqHcTBAU4nG87ex7y7AS9p+Cbc6EOSR9X1qIB8KxtbA== + +"@swc/core-linux-x64-musl@1.2.189": + version "1.2.189" + resolved "https://registry.yarnpkg.com/@swc/core-linux-x64-musl/-/core-linux-x64-musl-1.2.189.tgz#1ce88e44952d0d4f525016c7841c1443f91de788" + integrity sha512-/p5yXa9HEzpVEuE4ivkW1IvwyYu6fT+L2OvVEs5oXIba80F0Wjy7InWqaa83gwrdMH+bXV6loG8LzZUZu/lpjA== + +"@swc/core-win32-arm64-msvc@1.2.189": + version "1.2.189" + resolved "https://registry.yarnpkg.com/@swc/core-win32-arm64-msvc/-/core-win32-arm64-msvc-1.2.189.tgz#2ad4d2aacd0032c1f8a859bba963207436a78769" + integrity sha512-o/1ueM6/sifNjYnO6NMEXB895spVfJs5oQIPxQG9vJ/4zWLw8YmAx+u1xJY+XGyK6gnroHt7yPiS87qWdbeF6w== + +"@swc/core-win32-ia32-msvc@1.2.189": + version "1.2.189" + resolved "https://registry.yarnpkg.com/@swc/core-win32-ia32-msvc/-/core-win32-ia32-msvc-1.2.189.tgz#93dee76f59760b8eb516a2e55111fdeaf1e8c6c8" + integrity sha512-YDwRkzykaf+dw5Z7u189cC/Tttkn2NVV84hrGL3LbVuh7wT5PaDhZs4Yz4unZQSlPV12olmZWgNr/i27h5wlpg== + +"@swc/core-win32-x64-msvc@1.2.189": + version "1.2.189" + resolved "https://registry.yarnpkg.com/@swc/core-win32-x64-msvc/-/core-win32-x64-msvc-1.2.189.tgz#eeb127740952e3dd5cae2866c2da60346fed457b" + integrity sha512-Nge8Z/ZkAp5p5No50yBDpBG7+ZYaVWGSuwtPj6OJe7orzvDCEm9GgcVE6J9GEjbclSWlCH8B8lUe17GaKRZHbg== "@swc/core@^1.2.119", "@swc/core@^1.2.173", "@swc/core@^1.2.181": - version "1.2.185" - resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.2.185.tgz#26cdc7f9417fd2f04fde7f97d0b217aaa1bc8d3b" - integrity sha512-dDNzDrJ4bzMVWeFWqLJojjv5XZJZ84Zia7kQdJjp+kfOMdEhS+onrAwrk5Q88PlAvbrhY6kQbWD2LZ8JdyEaSQ== + version "1.2.189" + resolved "https://registry.yarnpkg.com/@swc/core/-/core-1.2.189.tgz#8db88e809764e5b3b2be3fcac0da9d9d957e1056" + integrity sha512-S5cKX4ECMSfW78DLFgnlilJZgjrFRYwPslrrwpLl3gpwh+Qo72/Mhn71u7G/5xXW+T/xW5GwPccHfCk+k72uUg== optionalDependencies: - "@swc/core-android-arm-eabi" "1.2.185" - "@swc/core-android-arm64" "1.2.185" - "@swc/core-darwin-arm64" "1.2.185" - "@swc/core-darwin-x64" "1.2.185" - "@swc/core-freebsd-x64" "1.2.185" - "@swc/core-linux-arm-gnueabihf" "1.2.185" - "@swc/core-linux-arm64-gnu" "1.2.185" - "@swc/core-linux-arm64-musl" "1.2.185" - "@swc/core-linux-x64-gnu" "1.2.185" - "@swc/core-linux-x64-musl" "1.2.185" - "@swc/core-win32-arm64-msvc" "1.2.185" - "@swc/core-win32-ia32-msvc" "1.2.185" - "@swc/core-win32-x64-msvc" "1.2.185" + "@swc/core-android-arm-eabi" "1.2.189" + "@swc/core-android-arm64" "1.2.189" + "@swc/core-darwin-arm64" "1.2.189" + "@swc/core-darwin-x64" "1.2.189" + "@swc/core-freebsd-x64" "1.2.189" + "@swc/core-linux-arm-gnueabihf" "1.2.189" + "@swc/core-linux-arm64-gnu" "1.2.189" + "@swc/core-linux-arm64-musl" "1.2.189" + "@swc/core-linux-x64-gnu" "1.2.189" + "@swc/core-linux-x64-musl" "1.2.189" + "@swc/core-win32-arm64-msvc" "1.2.189" + "@swc/core-win32-ia32-msvc" "1.2.189" + "@swc/core-win32-x64-msvc" "1.2.189" "@swc/jest@^0.2.21": version "0.2.21" @@ -4703,14 +4703,14 @@ array-ify@^1.0.0: resolved "https://registry.yarnpkg.com/array-ify/-/array-ify-1.0.0.tgz#9e528762b4a9066ad163a6962a364418e9626ece" integrity sha1-nlKHYrSpBmrRY6aWKjZEGOlibs4= -array-includes@^3.1.3, array-includes@^3.1.4: - version "3.1.4" - resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.4.tgz#f5b493162c760f3539631f005ba2bb46acb45ba9" - integrity sha512-ZTNSQkmWumEbiHO2GF4GmWxYVTiQyJy2XOTa15sdQSrvKn7l+180egQMqlrMOUMCyLMD7pmyQe4mMDUT6Behrw== +array-includes@^3.1.3, array-includes@^3.1.4, array-includes@^3.1.5: + version "3.1.5" + resolved "https://registry.yarnpkg.com/array-includes/-/array-includes-3.1.5.tgz#2c320010db8d31031fd2a5f6b3bbd4b1aad31bdb" + integrity sha512-iSDYZMMyTPkiFasVqfuAQnWAYcvO/SeBSCGKePoEthjp4LEMTe4uLc7b025o4jAZpHhihh8xPo99TNWUWWkGDQ== dependencies: call-bind "^1.0.2" - define-properties "^1.1.3" - es-abstract "^1.19.1" + define-properties "^1.1.4" + es-abstract "^1.19.5" get-intrinsic "^1.1.1" is-string "^1.0.7" @@ -4738,14 +4738,15 @@ array.prototype.flat@^1.2.5: define-properties "^1.1.3" es-abstract "^1.19.0" -array.prototype.flatmap@^1.2.5: - version "1.2.5" - resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.2.5.tgz#908dc82d8a406930fdf38598d51e7411d18d4446" - integrity sha512-08u6rVyi1Lj7oqWbS9nUxliETrtIROT4XGTA4D/LWGten6E3ocm7cy9SIrmNHOL5XVbVuckUp3X6Xyg8/zpvHA== +array.prototype.flatmap@^1.3.0: + version "1.3.0" + resolved "https://registry.yarnpkg.com/array.prototype.flatmap/-/array.prototype.flatmap-1.3.0.tgz#a7e8ed4225f4788a70cd910abcf0791e76a5534f" + integrity sha512-PZC9/8TKAIxcWKdyeb77EzULHPrIX/tIZebLJUQOMR1OwYosT8yggdfWScfTBCDj5utONvOuPQQumYsU2ULbkg== dependencies: - call-bind "^1.0.0" + call-bind "^1.0.2" define-properties "^1.1.3" - es-abstract "^1.19.0" + es-abstract "^1.19.2" + es-shim-unscopables "^1.0.0" arrify@^1.0.1: version "1.0.1" @@ -6290,12 +6291,12 @@ cypress-axe@^0.14.0: resolved "https://registry.yarnpkg.com/cypress-axe/-/cypress-axe-0.14.0.tgz#5f5e70fb36b8cb3ba73a8ba01e9262ff1268d5e2" integrity sha512-7Rdjnko0MjggCmndc1wECAkvQBIhuy+DRtjF7bd5YPZRFvubfMNvrxfqD8PWQmxm7MZE0ffS4Xr43V6ZmvLopg== -cypress@8.7.0: - version "8.7.0" - resolved "https://registry.yarnpkg.com/cypress/-/cypress-8.7.0.tgz#2ee371f383d8f233d3425b6cc26ddeec2668b6da" - integrity sha512-b1bMC3VQydC6sXzBMFnSqcvwc9dTZMgcaOzT0vpSD+Gq1yFc+72JDWi55sfUK5eIeNLAtWOGy1NNb6UlhMvB+Q== +cypress@8.3.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/cypress/-/cypress-8.3.0.tgz#ba906d2170888073ad94b2be1b994a749bbb7c7d" + integrity sha512-zA5Rcq8AZIfRfPXU0CCcauofF+YpaU9HYbfqkunFTmFV0Kdlo14tNjH2E3++MkjXKFnv3/pXq+HgxWtw8CSe8Q== dependencies: - "@cypress/request" "^2.88.6" + "@cypress/request" "^2.88.5" "@cypress/xvfb" "^1.2.4" "@types/node" "^14.14.31" "@types/sinonjs__fake-timers" "^6.0.2" @@ -6329,7 +6330,6 @@ cypress@8.7.0: minimist "^1.2.5" ospath "^1.2.2" pretty-bytes "^5.6.0" - proxy-from-env "1.0.0" ramda "~0.27.1" request-progress "^3.0.0" supports-color "^8.1.1" @@ -6495,6 +6495,14 @@ define-properties@^1.1.3: dependencies: object-keys "^1.0.12" +define-properties@^1.1.4: + version "1.1.4" + resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.4.tgz#0b14d7bd7fbeb2f3572c3a7eda80ea5d57fb05b1" + integrity sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA== + dependencies: + has-property-descriptors "^1.0.0" + object-keys "^1.1.1" + del@^6.0.0: version "6.0.0" resolved "https://registry.yarnpkg.com/del/-/del-6.0.0.tgz#0b40d0332cea743f1614f818be4feb717714c952" @@ -6937,11 +6945,47 @@ es-abstract@^1.19.0, es-abstract@^1.19.1: string.prototype.trimstart "^1.0.4" unbox-primitive "^1.0.1" +es-abstract@^1.19.2, es-abstract@^1.19.5: + version "1.20.1" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.20.1.tgz#027292cd6ef44bd12b1913b828116f54787d1814" + integrity sha512-WEm2oBhfoI2sImeM4OF2zE2V3BYdSF+KnSi9Sidz51fQHd7+JuF8Xgcj9/0o+OWeIeIS/MiuNnlruQrJf16GQA== + dependencies: + call-bind "^1.0.2" + es-to-primitive "^1.2.1" + function-bind "^1.1.1" + function.prototype.name "^1.1.5" + get-intrinsic "^1.1.1" + get-symbol-description "^1.0.0" + has "^1.0.3" + has-property-descriptors "^1.0.0" + has-symbols "^1.0.3" + internal-slot "^1.0.3" + is-callable "^1.2.4" + is-negative-zero "^2.0.2" + is-regex "^1.1.4" + is-shared-array-buffer "^1.0.2" + is-string "^1.0.7" + is-weakref "^1.0.2" + object-inspect "^1.12.0" + object-keys "^1.1.1" + object.assign "^4.1.2" + regexp.prototype.flags "^1.4.3" + string.prototype.trimend "^1.0.5" + string.prototype.trimstart "^1.0.5" + unbox-primitive "^1.0.2" + es-module-lexer@^0.9.0: version "0.9.3" resolved "https://registry.yarnpkg.com/es-module-lexer/-/es-module-lexer-0.9.3.tgz#6f13db00cc38417137daf74366f535c8eb438f19" integrity sha512-1HQ2M2sPtxwnvOvT1ZClHyQDiggdNjURWpY2we6aMKCQiUVxTmVs2UYPLIrD84sS+kMdUwfBSylbJPwNnBrnHQ== +es-shim-unscopables@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/es-shim-unscopables/-/es-shim-unscopables-1.0.0.tgz#702e632193201e3edf8713635d083d378e510241" + integrity sha512-Jm6GPcCdC30eMLbZ2x8z2WuRwAws3zTBBKuusffYVUrNj/GVSUAZ+xKMaUpfNDR5IbyNA5LJbaecoUVbmUcB1w== + dependencies: + has "^1.0.3" + es-to-primitive@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" @@ -7063,24 +7107,24 @@ eslint-plugin-react-hooks@^4.5.0: integrity sha512-8k1gRt7D7h03kd+SAAlzXkQwWK22BnK6GKZG+FJA6BAGy22CFvl8kCIXKpVux0cCxMWDQUPqSok0LKaZ0aOcCw== eslint-plugin-react@^7.29.4: - version "7.29.4" - resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.29.4.tgz#4717de5227f55f3801a5fd51a16a4fa22b5914d2" - integrity sha512-CVCXajliVh509PcZYRFyu/BoUEz452+jtQJq2b3Bae4v3xBUWPLCmtmBM+ZinG4MzwmxJgJ2M5rMqhqLVn7MtQ== + version "7.30.0" + resolved "https://registry.yarnpkg.com/eslint-plugin-react/-/eslint-plugin-react-7.30.0.tgz#8e7b1b2934b8426ac067a0febade1b13bd7064e3" + integrity sha512-RgwH7hjW48BleKsYyHK5vUAvxtE9SMPDKmcPRQgtRCYaZA0XQPt5FSkrU3nhz5ifzMZcA8opwmRJ2cmOO8tr5A== dependencies: - array-includes "^3.1.4" - array.prototype.flatmap "^1.2.5" + array-includes "^3.1.5" + array.prototype.flatmap "^1.3.0" doctrine "^2.1.0" estraverse "^5.3.0" jsx-ast-utils "^2.4.1 || ^3.0.0" minimatch "^3.1.2" object.entries "^1.1.5" object.fromentries "^2.0.5" - object.hasown "^1.1.0" + object.hasown "^1.1.1" object.values "^1.1.5" prop-types "^15.8.1" resolve "^2.0.0-next.3" semver "^6.3.0" - string.prototype.matchall "^4.0.6" + string.prototype.matchall "^4.0.7" eslint-plugin-simple-import-sort@^7.0.0: version "7.0.0" @@ -7778,11 +7822,26 @@ function-bind@^1.1.1: resolved "https://registry.yarnpkg.com/function-bind/-/function-bind-1.1.1.tgz#a56899d3ea3c9bab874bb9773b7c5ede92f4895d" integrity sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A== +function.prototype.name@^1.1.5: + version "1.1.5" + resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.5.tgz#cce0505fe1ffb80503e6f9e46cc64e46a12a9621" + integrity sha512-uN7m/BzVKQnCUF/iW8jYea67v++2u7m5UgENbHRtdDVclOUP+FMPlCNdmk0h/ysGyo2tavMJEDqJAkJdRa1vMA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.19.0" + functions-have-names "^1.2.2" + functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= +functions-have-names@^1.2.2: + version "1.2.3" + resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" + integrity sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ== + gauge@~2.7.3: version "2.7.4" resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" @@ -8175,6 +8234,11 @@ has-bigints@^1.0.1: resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.1.tgz#64fe6acb020673e3b78db035a5af69aa9d07b113" integrity sha512-LSBS2LjbNBTf6287JEbEzvJgftkF5qFkmCo9hDRpAzKhUOlJ+hx8dd4USs00SgsUNwc4617J9ki5YtEClM2ffA== +has-bigints@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/has-bigints/-/has-bigints-1.0.2.tgz#0871bd3e3d51626f6ca0966668ba35d5602d6eaa" + integrity sha512-tSvCKtBr9lkF0Ex0aQiP9N+OpV4zi2r/Nee5VkRDbaqv35RLYMzbwQfFSZZH0kR+Rd6302UJZ2p/bJCEoR3VoQ== + has-flag@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" @@ -8190,11 +8254,23 @@ has-own-prop@^2.0.0: resolved "https://registry.yarnpkg.com/has-own-prop/-/has-own-prop-2.0.0.tgz#f0f95d58f65804f5d218db32563bb85b8e0417af" integrity sha512-Pq0h+hvsVm6dDEa8x82GnLSYHOzNDt7f0ddFa3FqcQlgzEiptPqL+XrOJNavjOzSYiYWIrgeVYYgGlLmnxwilQ== +has-property-descriptors@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz#610708600606d36961ed04c196193b6a607fa861" + integrity sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ== + dependencies: + get-intrinsic "^1.1.1" + has-symbols@^1.0.1, has-symbols@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.2.tgz#165d3070c00309752a1236a479331e3ac56f1423" integrity sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== +has-symbols@^1.0.3: + version "1.0.3" + resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.3.tgz#bb7b2c4349251dce87b125f7bdf874aa7c8b39f8" + integrity sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A== + has-tostringtag@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.0.tgz#7e133818a7d394734f941e73c3d3f9291e658b25" @@ -8928,6 +9004,11 @@ is-negative-zero@^2.0.1: resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.1.tgz#3de746c18dda2319241a53675908d8f766f11c24" integrity sha512-2z6JzQvZRa9A2Y7xC6dQQm4FSTSTNWjKIYYTt4246eMTJmIo0Q+ZyOsU66X8lxK1AbB92dFeglPLrhwpeRKO6w== +is-negative-zero@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.2.tgz#7bf6f03a28003b8b3965de3ac26f664d765f3150" + integrity sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA== + is-npm@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/is-npm/-/is-npm-5.0.0.tgz#43e8d65cc56e1b67f8d47262cf667099193f45a8" @@ -9022,6 +9103,13 @@ is-shared-array-buffer@^1.0.1: resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.1.tgz#97b0c85fbdacb59c9c446fe653b82cf2b5b7cfe6" integrity sha512-IU0NmyknYZN0rChcKhRO1X8LYz5Isj/Fsqh8NJOSf+N/hCOTwy29F32Ik7a+QszE63IdvmwdTPDd6cZ5pg4cwA== +is-shared-array-buffer@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz#8f259c573b60b6a32d4058a1a07430c0a7344c79" + integrity sha512-sqN2UDu1/0y6uvXyStCOzyhAjCSlHceFoMKJW8W9EU9cvic/QdsZ0kEU93HEy3IUEFZIiH/3w+AH/UQbPHNdhA== + dependencies: + call-bind "^1.0.2" + is-ssh@^1.3.0: version "1.3.3" resolved "https://registry.yarnpkg.com/is-ssh/-/is-ssh-1.3.3.tgz#7f133285ccd7f2c2c7fc897b771b53d95a2b2c7e" @@ -9077,6 +9165,13 @@ is-weakref@^1.0.1: dependencies: call-bind "^1.0.0" +is-weakref@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/is-weakref/-/is-weakref-1.0.2.tgz#9529f383a9338205e89765e0392efc2f100f06f2" + integrity sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ== + dependencies: + call-bind "^1.0.2" + is-whitespace-character@^1.0.0: version "1.0.4" resolved "https://registry.yarnpkg.com/is-whitespace-character/-/is-whitespace-character-1.0.4.tgz#0858edd94a95594c7c9dd0b5c174ec6e45ee4aa7" @@ -11076,13 +11171,13 @@ object.getownpropertydescriptors@^2.0.3: define-properties "^1.1.3" es-abstract "^1.19.1" -object.hasown@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/object.hasown/-/object.hasown-1.1.0.tgz#7232ed266f34d197d15cac5880232f7a4790afe5" - integrity sha512-MhjYRfj3GBlhSkDHo6QmvgjRLXQ2zndabdf3nX0yTyZK9rPfxb6uRpAac8HXNLy1GpqWtZ81Qh4v3uOls2sRAg== +object.hasown@^1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/object.hasown/-/object.hasown-1.1.1.tgz#ad1eecc60d03f49460600430d97f23882cf592a3" + integrity sha512-LYLe4tivNQzq4JdaWW6WO3HMZZJWzkkH8fnI6EebWl0VZth2wL2Lovm74ep2/gZzlaTdV62JZHEqHQ2yVn8Q/A== dependencies: - define-properties "^1.1.3" - es-abstract "^1.19.1" + define-properties "^1.1.4" + es-abstract "^1.19.5" object.values@^1.1.5: version "1.1.5" @@ -11992,11 +12087,6 @@ proxy-addr@~2.0.7: forwarded "0.2.0" ipaddr.js "1.9.1" -proxy-from-env@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/proxy-from-env/-/proxy-from-env-1.0.0.tgz#33c50398f70ea7eb96d21f7b817630a55791c7ee" - integrity sha1-M8UDmPcOp+uW0h97gXYwpVeRx+4= - psl@^1.1.28: version "1.8.0" resolved "https://registry.yarnpkg.com/psl/-/psl-1.8.0.tgz#9326f8bcfb013adcc005fdff056acce020e51c24" @@ -12466,13 +12556,14 @@ regenerator-transform@^0.15.0: dependencies: "@babel/runtime" "^7.8.4" -regexp.prototype.flags@^1.3.1: - version "1.3.1" - resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.3.1.tgz#7ef352ae8d159e758c0eadca6f8fcb4eef07be26" - integrity sha512-JiBdRBq91WlY7uRJ0ds7R+dU02i6LKi8r3BuQhNXn+kmeLN+EfHhfjqMRis1zJxnlu88hq/4dx0P2OP3APRTOA== +regexp.prototype.flags@^1.4.1, regexp.prototype.flags@^1.4.3: + version "1.4.3" + resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz#87cab30f80f66660181a3bb7bf5981a872b367ac" + integrity sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA== dependencies: call-bind "^1.0.2" define-properties "^1.1.3" + functions-have-names "^1.2.2" regexpp@^3.2.0: version "3.2.0" @@ -12811,9 +12902,9 @@ rimraf@^2.6.3: glob "^7.1.3" rollup@^2.72.1: - version "2.73.0" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.73.0.tgz#128fef4b333fd92d02d6929afbb6ee38d7feb32d" - integrity sha512-h/UngC3S4Zt28mB3g0+2YCMegT5yoftnQplwzPqGZcKvlld5e+kT/QRmJiL+qxGyZKOYpgirWGdLyEO1b0dpLQ== + version "2.74.1" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.74.1.tgz#4fba0ff1c312cc4ee82691b154eee69a0d01929f" + integrity sha512-K2zW7kV8Voua5eGkbnBtWYfMIhYhT9Pel2uhBk2WO5eMee161nPze/XRfvEQPFYz7KgrCCnmh2Wy0AMFLGGmMA== optionalDependencies: fsevents "~2.3.2" @@ -13483,18 +13574,18 @@ string-width@^5.0.0, string-width@^5.0.1: emoji-regex "^9.2.2" strip-ansi "^7.0.1" -string.prototype.matchall@^4.0.6: - version "4.0.6" - resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.6.tgz#5abb5dabc94c7b0ea2380f65ba610b3a544b15fa" - integrity sha512-6WgDX8HmQqvEd7J+G6VtAahhsQIssiZ8zl7zKh1VDMFyL3hRTJP4FTNA3RbIp2TOQ9AYNDcc7e3fH0Qbup+DBg== +string.prototype.matchall@^4.0.7: + version "4.0.7" + resolved "https://registry.yarnpkg.com/string.prototype.matchall/-/string.prototype.matchall-4.0.7.tgz#8e6ecb0d8a1fb1fda470d81acecb2dba057a481d" + integrity sha512-f48okCX7JiwVi1NXCVWcFnZgADDC/n2vePlQ/KUCNqCikLLilQvwjMO8+BHVKvgzH0JB0J9LEPgxOGT02RoETg== dependencies: call-bind "^1.0.2" define-properties "^1.1.3" es-abstract "^1.19.1" get-intrinsic "^1.1.1" - has-symbols "^1.0.2" + has-symbols "^1.0.3" internal-slot "^1.0.3" - regexp.prototype.flags "^1.3.1" + regexp.prototype.flags "^1.4.1" side-channel "^1.0.4" string.prototype.trimend@^1.0.4: @@ -13505,6 +13596,15 @@ string.prototype.trimend@^1.0.4: call-bind "^1.0.2" define-properties "^1.1.3" +string.prototype.trimend@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.5.tgz#914a65baaab25fbdd4ee291ca7dde57e869cb8d0" + integrity sha512-I7RGvmjV4pJ7O3kdf+LXFpVfdNOxtCW/2C8f6jNiW4+PQchwxkCDzlk1/7p+Wl4bqFIZeF47qAHXLuHHWKAxog== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.4" + es-abstract "^1.19.5" + string.prototype.trimstart@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.4.tgz#b36399af4ab2999b4c9c648bd7a3fb2bb26feeed" @@ -13513,6 +13613,15 @@ string.prototype.trimstart@^1.0.4: call-bind "^1.0.2" define-properties "^1.1.3" +string.prototype.trimstart@^1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.5.tgz#5466d93ba58cfa2134839f81d7f42437e8c01fef" + integrity sha512-THx16TJCGlsN0o6dl2o6ncWUsdgnLRSA23rRE5pyGBw/mLr3Ej/R2LaqCtgP8VNMGZsvMWnf9ooZPyY2bHvUFg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.4" + es-abstract "^1.19.5" + string_decoder@^1.1.1: version "1.3.0" resolved "https://registry.yarnpkg.com/string_decoder/-/string_decoder-1.3.0.tgz#42f114594a46cf1a8e30b0a84f56c78c3edac21e" @@ -14143,6 +14252,16 @@ unbox-primitive@^1.0.1: has-symbols "^1.0.2" which-boxed-primitive "^1.0.2" +unbox-primitive@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.2.tgz#29032021057d5e6cdbd08c5129c226dff8ed6f9e" + integrity sha512-61pPlCD9h51VoreyJ0BReideM3MDKMKnh6+V9L08331ipq6Q8OFXZYiqP6n/tbHx4s5I9uRhcye6BrbkizkBDw== + dependencies: + call-bind "^1.0.2" + has-bigints "^1.0.2" + has-symbols "^1.0.3" + which-boxed-primitive "^1.0.2" + unherit@^1.0.4: version "1.1.3" resolved "https://registry.yarnpkg.com/unherit/-/unherit-1.1.3.tgz#6c9b503f2b41b262330c80e91c8614abdaa69c22"